Do you experience these symptoms if you test your device in safe mode?
If your phone is misbehaving, it's possible that a third-party app is causing the issue. To figure out what app is acting funny, you can use the Safe Mode feature. In Safe Mode, your phone won't run any third-party apps. This allows you to easily identity and remove the app that may be causing the problem. Give this link a try: https://www.samsung.com/us/support/answer/ANS00062983/
I would recommend wiping the cache partition on your device. The system cache partition stores temporary system data. It's supposed to allow the system to access apps more quickly and efficiently, but sometimes things get cluttered and outdated, so a periodic cache clearing can help make the system run more smoothly. Give these steps a try:
Do you notice any patterns to the device restarting?
Can I please have your full model number, baseband version, and service provider?