Chosen Solution

Whenever I click the earpiece/face id flex, the phone keeps rebooting but when it’s unclipped and power on it boot.

It appears you may have damaged the flex. It could be a small tear or bend that is under tension when the assembly is clipped in place or it could be that the flex is scratched and grounding out on the case. Take a close look at the condition of the flex, preferably with magnification to see if there is anything you can see.