How do I prevent hackers that use developer apps to manipulate devices

I received a screen shot from someone that was intetionally setting me up to be hacked. The picture had some kind of hidden code that left my device venerable. Shortly after my device was completely taken over by hackers using code and developers apps. I tapped on the build number on my phone 8 times to access developer options. When I did I got a pop up saying I am already a developer. This has now been going on a long time and I have been able to narrow thinga down. I need assistance with cleaning out the device. If I restore the device it restores from an existing back up and makes it worse. Thank you