This article explains how to export text messages from an iPhone running iOS 14 and later, as well as how to save individual messages and entire conversations.
[4 Ways] Export Text Messages/iMessages from iPhone
There is no way in iOS to export a text message or text thread directly from the iMessages app. However, there are a few workarounds that will let you save and send your messages elsewhere. These workarounds include taking screenshots of the texts and sending them as images, copying the messages and forwarding them via iMessage, or copying them to Pages and exporting the messages as PDFs.
Since there is no built-in one, you will need to save them in another format. The easiest way is to take a screenshot of the message(s) and then forward the messages to email.
First, take a screenshot of the messages you want to save by pressing the side button and volume up key at the same time. You may need to take multiple screenshots if you want to capture a long message thread.