Whether you misspell someone's name, accidentally send them the wrong meme or just plain screw up your text, sometimes it's good to be able to edit your messages before they get out. The good news is that iOS 16 (and later) brings the ability to edit your iMessages, so long as you catch them within 15 minutes of sending them.
The feature is only available for iMessage conversations with other Apple users. That means it won't work for SMS conversations (which appear as green bubbles on non-Apple devices), or for calls and FaceTime chats. To edit a message, open the Messages app and select the conversation in which you want to edit a message. Tap and hold the message until a menu appears, then tap Edit. You can make up to five edits to a message before the option disappears.
When you've made an edit, the recipient will see a blue check mark next to your message. They'll also be able to see your entire edit history in the conversation transcript. The only thing to keep in mind is that if you edit a message sent to a user with iOS 16 or later, or iPadOS 16 or later, the edited version will replace the original. Users with older versions of the OS will receive a new text message showing your edit history, which they can tap to see the previous version.
If you don't see the Edit option when pressing a message, try force quitting the Messages app and then reopening it. If that doesn't help, restart your device, then try again. If all else fails, contact Apple Support.