To block a number, from the home screen, select Messages.
Select the Desired message thread.
Select the Info icon.
Select the Displayed contact or phone number you want to block.
Scroll to the bottom of the Info screen and then select Block this Caller.
Select Block Contact.
To unblock, select Unblock this Caller.
You can see the contacts and phone numbers that you've blocked in Settings under Messages > Blocked, Phone > Blocked, or FaceTime > Blocked. You can also Add New blocked numbers and Edit (Unblock) numbers from within Settings. Note: Learn more from Apple support article: Block calls and block or filter messages on your iPhone