Read this guide to learn how to stop people you don't know from contacting you on Snapchat.
Steps

Step 1. Open Snapchat
The app icon is yellow, with a white ghost in the center.
Enter your username and password if you are not already logged in

Step 2. Scroll down
Your user profile screen will open.

Step 3. Press ⚙️
You will find this button in the upper right corner of the screen; press it and the "Settings" menu will open.

Step 4. Scroll down and press Contact Me
This is the first item in the "Who can …" section of the menu.

Step 5. Press My Friends

Step 6. Press the Back arrow
You will find it in the upper left corner. Now, only people you've added as friends can message you on Snapchat.