Overheating and unable devices especially settings

The problem is arising because storage or RAM of your phone is full and it needs to be cleared. So, wipe some cache by going into Fastboot mode learn from this link – https://www.tenorshare.com/fix-android/how-to-enter-fastboot-mode-on-samsung.html