I do not know about your experiences, but lately spam callers and spam text services have infiltrated my cell phone. Stay vigilant and keep your device personal and controlled. The process to block a caller or a random (or known) number from texting you is not intuitive. Here are the steps and a couple of visuals to guide you through the process.
To block a number that has called you it is important that you NOT delete the number until you block the number first.
To block a number from texting you, open the Messages app.