IOS 8 provides a few different ways on your iPhone to block a number from calling or sending a message. However, the number has to be tied to a contact, so if the number you are blocking is not a contact, create a new contact so you can block it. Blocking a contact can be performed through the iPhone settings or from the Phone or Message apps.
Blocking a Contact From Settings
Open your iPhone's Settings app and tap on Phone.
Tap Add New... .
Select the contact you want to block.
Blocking a Contact From Recent Calls
Open the iPhone Phone app and tap on Recents at the bottom of the screen. Click the Information Button next to the contact's name.
Scroll to the bottom of the Info screen and tap Block This Caller.
Tap Block Contact.
Blocking a Contact From Messages
Open the Messages app and tap on the message from the contact you want to block.
Tap on Details in iOS 8 or the Info button in iOS 7 in the upper-right corner of the screen.
Tap on the Info button in the upper-right corner of the screen.
Select Block This Caller at the bottom of the Info screen.
Confirm by tapping Block Contact.
Unblocking a Contact
Go to the Settings app, and as you did for blocking a contact, go to Blocked in the Phone settings. Tap Edit in the upper-right corner.
Tap the Negative Sign next to the name of the Contact you want to unblock.
Confirm by tapping Unblock.