One of the new iOS 16 features will allow you to unsend or edit a message after sending them. But this only works if you're sending a message to another iOS 16 user. And you can only edit or unsend a message up to 15 minutes after it's been sent. After that, it will be uneditable or can no longer be unsent. Those running iOS 15 or earlier won't get this feature. And they might even see the messages you have unsent even if it's no longer visible from your end.
To edit or unsend a message, you need to long-press on the specific line in your conversation and tap on either Edit or Undo Send. As MacRumors pointed out, these features will only be available to blue bubble iMessages and not the green SMS messages.