I have a Samsung Galaxy S5 that I really like. It started rebooting at random a few months ago. I got it stable for a few minutes and factory reset it. Apparently everything wasn't backed up. So goes it.
Now it reboots endlessly. I did get it stable for a few minutes, factory reset it again, and when I was signing in to my Samsung acct, it started rebooting again.
This is my favorite phone. I have an S2 which I've had for over seven years, and it's going strong - even loaded with apps.