If you could provide more details that would make it easier for us to make relevant suggestions. If somehow your phone was hacked into and has been compromised than a Factory Reset might help but whenever you do a Reset it's really, really important to have all your data backed up first or you'll lose it. And never just back it up, confirm the data is where you backed it up to.
But getting back to your problem, if your phone was compromised involving the Android operating system on your phone than a Factory Reset will do nothing to fix that. In this case that involves a more cumbersome process, flashing a stock ROM (essentially replacing the old operating system with a new copy). But again, more details on just what kind of problems you're having can help determined just what is going on.
A very common problem these days is a matter where someone's email account or some social media account has been compromised. In that case it's not your phone, it's a matter of regaining control of your online account(s).