How to turn off inline predictions on iPhone
Go to Settings → General → Keyboard and turn off Show Predictions Inline. Leave Predictive Text enabled if you still want the suggestions above the keyboard.
Choose which suggestions to keep
Inline predictions are the gray completions inside your text field. The suggestion bar shows possible words and emoji above the keys. Turn off Show Predictions Inline to remove the gray continuation. Turning off Predictive Text disables both kinds of predictions in Apple's keyboard.
Check autocorrect separately
Type a short sentence in Notes after changing the setting. If a misspelling is still replaced at a word boundary, check Auto-Correction. It has its own setting, and you can keep suggestions while disabling autocorrect.
These switches describe Apple's keyboard, and inline predictions are available only in supported languages. Third-party keyboards have their own controls. See Apple's predictive text guide.