If your device is restarting randomly after 1-2 minutes this could be caused by battery data issues.
I would confirm this by downloading 3Utools and check if your battey shows battery data.
If your phone does have a sensor issue this would of caused a bootloop causing the device not to pass apple logo.
Replacing the proximity sensor is possible however you will lose Face Id, To keep Face id the Hall sensor will need to be transferred over from original flex to another.
Compass ic failing can als be caused by fractures in the layers of the motherboard and this would need to be done with someone that has board level repair experience.
Hope that helps :)