Check to see if iPhone is being tracked

i am worried that someone I know that has access to my iPhone has put some sort of software on it so as to know all that happens on my phone and around it. I have heard there is software around that can go undetected but give out all the information to the person that installed it. Is there a way I can check to see if it's hidden on my iPhone some were????
Erase all content and settings on the phone, restore the iOS and set it up as a new device.
And configure a passcode nobody knows or can easily guess.

Original thread: https://forums.imore.com/threads/check-to-see-if-iphone-is-being-tracked.337603/