Hi M_0072,
Thanks for posting in Apple Support Communities.
We understand that your display appears to freeze and you have to retype your keyboard input. If the display is unresponsive now, force restart it.
On your iPhone 8 or later, including iPhone SE (2nd and 3rd generation)
1. Press and quickly release the volume up button.
2. Press and quickly release the volume down button.
3. Press and hold the side button until you see the Apple logo.

4. If your phone doesn't turn on, follow these steps to check your hardware and charge your phone. You might need to charge for up to an hour.
5. If your phone still doesn't turn on, contact Apple Support.
You can find these steps in If your iPhone won't turn on or is frozen.
If iPhone is on and working, but freezes only when typing, restart your iPhone to restart running processes and make sure you have the latest update installed. You can remove the affected keyboard and add it back from Settings > General > Keyboard > Keyboards. Choose Edit and and select the minus to remove the keyboard. Restart your iPhone, go back to your keyboard settings and add the keyboard.
Regards.