Your deleted iPhone messages are kept in some kind of a recycle bin for a period of time and you can recover them if you need to.
iPhone messages are not erased when you choose to delete them. Instead, they are kept for a period of time and during that time they are recoverable.
To recover a deleted message on an iPhone do this:
ℹ️ Open the Messages app;
ℹ️ Tap the edit button on the upper left corner;
ℹ️ Choose Show Recently Deleted from the menu;
ℹ️ Select the topic you want to recover;
ℹ️ Tap Recover.
Recovered messages will appear in the app among all other messages.