Average android phone wont allow me to factory reset because it instantly restarts as soon as is says starting apps?

cant remove the battery cause its connected by some bit of material. as soon as I turn the phone on it starts up then it goes on optimizing apps, then it says starting apps and its at this point it will just go back to turning on and saying optimizing apps. I had a feeling it had to be a virus or something wrong with the software. I got it to turn on properly once and in that time I put it on safety mode and deleted a bunch of apps but found out I didn't delete enough perhaps so Ive been looking for another opportunity to get it to go on and factory reset to completely remove any virus. I cant buy a new phone till the end of the term and id much rather save up or something else instead and keep this one cause its a decent phone that I spent quite a bit on and lost the warranty. or never got one. not sure. does anyone know any methods of getting it to temporarily work. just so I have enough time to switch it to safety mode. you probably didn't read this entire thing, apologies for making it so long
Answers

Olive

Sounds like the Starting Apps issue is whats causing issues. Try this--- first Power phone OFF then Press the VOLUME UP, HOME and POWER buttons all the same time and HOLD THEM DOWN release only the POWER button when the device vibrates, release the other buttons when the ANDROID SYSTEM RECOVERY screen appears using the VOLUME DOWN / UP buttons to navigate, select WIPE CACHE PARTITION press the POWER button, which will activate the ENTER key on your keyboard you will likely see some progress notes (at the bottom of the screen in small print) and after about 20 seconds it will show DONE you can then reboot the device and use your smartphone---This should fix any issue with your phone and wont delete any apps or music, videos etc