I got my one plus 5 around a year back. Around 6 months back, my phone started switching on and off every second. It wouldn’t even log in for enough time to get to the screen lock password. When I had taken to repair, they said it was a button issue and then fixed it for quite a price. Just when I thought it was all okay, a week back my phone started doing the same thing. But this time it didn’t do it every second. The pattern was very random. This is just even scarier right now because I have online exams. My previous phone- Moto G5 plus also had the same problem. I had to throw that away because it was almost 3 years old and got a new phone.
I really hope it gets fixed this time. Also I have tried all the options and I have also updated the lastest software on my phone