How to copy/paste parts of a text in Messages.app
It does have an odd behaviour, but one that's easy to work round.
If you click-hold, the 'reaction' pop-up will appear, so the trick is just a short click.
If you click once straight onto the message bubble, anywhere, the text goes grey. At this point any interaction is with the entire message. If you directly double click or right click whilst the text is initially black, it doesn't go to grey, you can interact directly.
Basically, don't do that first click. You can do anything else &amp; it works as individual words - so right click, double-click or click-drag works, for instance.
If you click outside the message bubble, the text goes back to black &amp; you can now interact like any ordinary text.
BTW, verification codes like that will be found by Safari &amp; will click right into the web page.
Examples

Grey text - handled as a single item for copy/paste.



Black text, can be individually selected.



Same in dark mode (first message is selected)



Smart fill-in feature in Safari