Spyware in iPhone-Not jailbreak

How to check if some spyware or snooping app is installed in iPhone? If the app is recording voices or videos, should the indicator/dot come on screen or there are spying apps that can bypass that? Also, resetting/erasing the Iphone will delete any spyware app/software? If I restore backup from Mac, can the spyware app/software again come on my phone?
Resetting an iPhone will cause it to be erased and then cause the latest official iOS version compatible with the device to be installed so in theory, any app or file not associated with iOS should get deleted.

Original thread: https://forums.imore.com/threads/spyware-in-iphone-not-jailbreak.456796/