Screenshotting works for three messages. It does not work for the three-year conversation with your mom, the custody-dispute thread, or the business agreement someone made over iMessage. And iCloud won't save you either — iCloud is sync, not an archive: delete a thread and it's gone from iCloud too. Saving texts permanently means getting them out of Apple's ecosystem into a file you own.
iPhone-to-iPhone transfers usually preserve messages. iPhone-to-Android usually doesn't — message history is the most common casualty of switching sides. Export the conversations that matter to PDF before the switch and the question stops mattering. (Coming from Android? Same idea, different tool: our Android text message reader.)
For custody, divorce, small-claims, or workplace disputes, format matters: courts want chronological, timestamped, numbered transcripts — not screenshot collages. The exporter's PDF does exactly that, including an optional sworn-declaration cover page. Details: printing text messages for court.
The habit that makes this automatic: back up quarterly, export the conversations you'd grieve to a PDF each time. Ten minutes, four times a year — and nothing short of a house fire takes those conversations from you. More: backing up text messages, both platforms.