Automatically fill in SMS passcodes on iPhone
When you sign in to some apps and websites, a one-time SMS passcode is sent to your iPhone. As a security measure, you are required to enter the code into the app or website. iPhone can detect the passcode in Messages and display it above the keyboard.
To use the passcode, tap it.
Note: With Continuity, all the SMS/MMS messages you send and receive on iPhone can also appear on your other iPhone, iPad, and iPod touch devices and your Mac. See the Apple Support article Use Continuity to connect your Mac, iPhone, iPad, iPod touch, and Apple Watch.