This is a bad contact between the rear panel and the motherboard. By using a magnet, the metal parts move slightly and restore contact for a few seconds. Pressing with the finger we have the same result. This type of fault also causes the loss of GPS signal , which G5 users have reported ... I think you have to open the phone, clean and move the contacts slightly.