MacbookPro 2018 13inch switches off frequently due to panic issue
This is technically called a 'kernel panic'.
If you want to try a few easy things, follow the instructions on this apple support page regarding this error:
https://support.apple.com/en-us/HT200553
Basically install any OS updates available, install software updates for other apps and drivers, reboot in safe mode, reset NVRAM, disconnect all the external devices.
Also you could try a hardware diagnostic by rebooting while you hold down the COMMAND key and the D key at the same time.
However, if you're near an Apple store, I highly recommend making a genius bar appointment to have them take a look at it. They will do a brief look for free, and give you a recommendation for what to do next.  Here is the link to do that:
https://getsupport.apple.com/

Click Mac
Click Mac Notebooks
TYPE IN &quot;restart&quot; into the text bar
click &quot;Unexpected shutdown or restart&quot; Click Bring In For Repair
Sign in with your Apple ID
Follow the instructions.