Welcome to Android Central! Which Samsung device do you have? Try clearing the app cache and data for your keyboard app in Settings>Apps. If that doesn't help, then try booting into Safe Mode.
Go to play.google.com/store (on any other device), log in, and install another keyboard on your phone. If you're using Google's Gboard, install SwiftKey. If you're using SwiftKey, install Gboard. They're both good. (If you're using something else, use one of those.)