To block a number, from the home screen select the Messages app.
Select the desired message thread.
Select the gray contact area at the top of the screen to get the drop down options, then select the Info icon.
Select the Displayed contact or phone number you want to block.
Scroll to and select Block this Caller.
Select Block Contact.
To unblock, select Unblock this Caller.
To view blocked contacts and phone numbers, from the home screen select the Settings app > scroll to and select Messages > scroll to and select Blocked. Blocked numbers will be displayed.
Note: Alternately, you can access blocked numbers and contacts by selecting the Settings app > scroll to and select Phone > Call Blocking & Identification or Settings > FaceTime > Blocked. Learn more from Apple support article: Block calls and block or filter messages on your iPhone.
To add new blocked numbers, from the Blocked screen select Add New. To unblock a number, from the Blocked screen select Edit > Delete icon > Unblock. When finished, select Done.