try clearing the cache/data of the Samsung keyboard app
Settings → Apps → three dots → Show system apps → Samsung Keyboard app → Storage → Clear data
try downloading and using Google Keyboard / Gboard
I've seen a few similar threads to yours and as such it can be a difficult process diagnosing what's making this happen.
For example my partner and daughter both have the Samsung s20 5G on Android 11 and Samsung One Ui 3.0 and have zero issues with keyboard.
Just as a process of elimination please put the phone into Safe Mode which disables your downloaded app's, but let's your stock app's keep working. If the issue with typing stops then this could highlight a downloaded app as the possible issue.
Come out of Safe Mode and start deleting your most recent downloaded app's one at a time until it stops.
I wish you all the best with this.
Current Phone ~
Samsung Note 20 Ultra 5G SM-N9860_256Gb SnapDragon 865+
Samsung One Ui 3.1/ Android 11.