Could be infected, but an iOS or app or network or hardware issue is far more likely.
Sure, the very usual and rare cause is possibly, but buggy software and buggy hardware is far more common.
If you are still using the original battery for instance, the battery is quite possibly failing.
The display and digitizer can also degrade and fail too, producing missed touches and ghost touches.
There are also adverts and spam and phishing campaigns which just lie, including the “pervert” spam.
What are the issues you are encountering, and what is the battery health?
Edit: Ah, and another reply got posted while entering this reply. That battery is waaaaaaaaaay past replacement. That’s very likely the case of whatever unexpected behaviors are arising here, too.