Some Samsung devices have preference settings to reset themselves. It maybe worth checking in its settings. Its called 'Auto Restart '
If this isn't the case then id also suggest to put the device into Safe Mode which will turn off all the downloaded apps and leaves the stock ones alone which can then help you see if its a rogue app.
Check that all Apps and Firmware is up to date.
You could try further self help troubleshooting by turning the device Off and from a set series of button pressess that takes you into the devices file system and clear the system cache.
A final self help troubleshooting option is to Back up and Factory Reset.
If necessary a Samsung Experience Store or Samsung Service Centre location can run a diagnostic on the devices.
Current Phone ~
Samsung Note 20 Ultra 5G SM-9820 _256Gb SnapDragon 865+
Samsung One Ui 2.5/ Android 10.