You can block Spam Messages to your IPhone by selecting tapping the sender’s information at the top of the screen, tap the info button, scroll to the bottom and click Block Caller.
Table of Contents
Select the message
Open a message from the sender you want to block.

It might be tempting to click the Report Junk link. Don’t. It simply reports the message as junk and doesn’t prevent the unwanted sender from messaging you again.
Tap the phone number
Instead, at the top of the screen, tap the sender’s profile picture (if there is one) or the phone number.
This effectively takes you to a screen where you can ‘edit’ (or block) the sender.
Tap the info button.

Block caller
Scroll down to the bottom of the screen and there in red will be the option to Block Caller.

For whatever reason, the wording changes from Block Caller to Block Contact. You will need to click the Block Contact option to confirm your request.
Once that is cone you will not receive phone calls, messages, or FaceTime from people on the block list.
Unblock caller
Oops. What do you do if you want to unblock a caller?
Just the opposite. Find the message, tap the phone number, tap info, scroll to the bottom and click Unblock Caller.
If you no longer have the message, instead go to Settings > Messages > Blocked Contacts > Find the phone number or contact you want to unblock > swipe right on that contact’s information and tap Unblock.