On many devices you can set call and message blocks from within your Contact List. If there’s a number you don’t want calling or texting you, find that person in your contact list and turn on the block option. If the number you want to block isn’t in your Contact List, you can add it and then block it. That number will be unable to call or send you text messages.
The steps to block a contact will vary by device. Refer to your user manual for instructions.