Not sure about Android, but on iOS a three finger tap will bring up a contextual menu which allows undo and redo, among other actions.
I just tried using this in a text screen. My first attempt was on the keyboard which added random characters and brought up the little thing at the top to undo, my second attempt was above the keyboard, but my most recent message was a link so I got taken to safari, and my third attempt in a small sliver of the message screen in the upper left worked.
Obviously if you're familiar with it, it's easier to do, but I rarely have three fingers available while I'm writing text on a phone.
Alternatively have Voice Control enabled and say "undo that".
There is also a three finger gesture: https://appleinsider.com/articles/19/06/27/new-ipados-button...