It would impossible to write a text message with the behavior you are experiencing in Messages on your iPhone, so I definitely understand your concern with this issue. I'm not sure if you have tried this, but I recommend first trying to restart your iPhone and then a reset if the restart doesn't work:
If the issue persists after the reset, I recommend restoring your iPhone. You can find steps for backing up and restoring your iPhone in the following links:
Thank you for posting in the Apple Support Communities.