If your iPhone is rebooting or your Messages app is constantly crashing, you might be the victim of an iOS exploit or just a buggy software update. While one problem sounds worse than the other, they both can get annoying real quick when you can't send any messages or even read new ones.
Before jumping to the worst-case scenario, it's likely that a new software update isn't playing nice with your iPhone model. Recently, some iOS 11 users have been reporting erratic behavior in the Messages app, so that could be what you're experiencing.
If you expect the worse, it's possible that it could be an iOS exploit and that somebody sent you a text message attack that could reboot your iPhone and/or consistently crash your Messages app. There have been a number of these exploits in the past that Apple has patched, but it's possible that somebody found another exploit to use.
The first thing you can try is simply force-closing the Messages app and opening it back up. If that didn't do the trick, then try restarting your iPhone. To do that, just press and hold the Side or Top button (aka the Sleep/Wake or Power button) for a few seconds, then use the slider that pops up to turn the iPhone off. Wait until it's powered down, then power it back up. If you're using iOS 11, you can restart using an Accessibility Shortcut, which may be easier.
If that doesn't work, you can try force-restarting your iPhone. On the iPhone 7 and 7 Plus, just hold down the Side button with the Volume Down button for ten seconds until the Apple logo appears. On earlier iPhone models, hold down the Home button and Side (or Top) button simultaneously for ten seconds until the Apple logo shows up. On the new iPhone 8 or 8 Plus the process is slightly different, which you can check out in the below link.
Still no dice? Try signing out and signing back into your Apple ID either in the Messages settings or the main Settings. There's a chance something went screwy when you first signed back in after updating.
If it is indeed an iOS exploit that's causing the issue, Apple will surely push a patch out in the next software update. Until then, there are a few ways to get your iPhone back up and running the way it was right now. Check out the tips below, which also includes a way to keep your iPhone from being hijacked in the future by vicious pranksters.
Use Siri to send a text message to the person that sent you the malicious text message. Just bring up Siri, say "View messages" or "Read unread text messages," then respond "Yes" when Siri asks if you would like to reply to the malicious text and send them anything.
Using this method, you'll be able to not only respond to contacts in your iPhone but also random phone numbers. As soon as they receive the regular text you sent using Siri, you'll be able to access Messages. This will also allow the sender of the malicious text to go into their Messages app since they're also unable to access their text messages.
From the Photos app, text message a picture or video to the person that sent you the malicious text message. Once they receive the photo, you and the sender will be able to go back into the Messages app.
Send a regular text message to the person that sent you the malicious text message. While you won't be able to access all your messages, sometimes you'll be able to access the thread of the person that sent the malicious text (or your own thread, if you were the sender). In this case, sending a regular text message to that person will fix your crashing issue, as well as theirs.
Delete the thread of the person that sent you the malicious text message, if you're able to access it. Or delete the entire thread of that you started (if you sent the attack to them). This will fix your crashing issue, as well as theirs.
If none of your shitty friends have done this to you (yet), you can take steps to prevent your iPhone from crashing. One way to do this is by disabling text messages on the lock screen, which you can do by going to Settings –> Notifications –> Messages, then turning off the "Show on Lock Screen" setting.
While your iPhone isn't completely free of issues, it will prevent the malicious text message from crashing your device when it's locked.