There are apps to scan for it on Android. It's quite unlikely on an apple device because the only way to install software on it is to download from the app store, which is highly secure and Apple doesn't let spyware in there.
If you've any doubts at all, wipe the phone clean and set it up again. Applecare can talk you though the process, or there should be plenty of instructions on line.
Its far more likely with Apple it would be done by non jailbreak using your Apple ID. Is it likley the person knows it? and do you have 2 stage authentication enabled (as its almost impossible to bypass it and no spyware works either when its enabled ) No need to wipe--change your Apple ID immediately, enable 2 factor authentication and dont give it out/write it down etc.
If he has jailbroken the iphone, then somewhere there will be the Cydia icon. do a spotlight search for Cydia (you just drag down from top quickly if you dont know how to do it) To do it though they would have to be quite techy! and have had access for around 10 minutes minimum plus your Apple ID
There is a way to install spyware or any other non approved Apple software on an iPhone and that’s if it’s been jail broken. Take it to an Apple store to check. In addition, change your Apple password.
you do not need to jailbreak an iphone to access 'stuff' (although what you can obtain is decreased--texts, calls, contacts, whatsapp etc ) Its limited to whats on an icloud backup essentially. Many of the big spyware players work on non jailbreak these days using icloud details and you dont have to even touch the phone for 1 minute--but you do need the icloud passwork. -- it doesnt work though if apple 2 factor authentication in place -- jailbreaking just means it has more 'stuff' it can access and often can 'listen in' etc . It also invalidates your iphone warranty I believe if jailbroken, however a geeky nerd will be able to tell. In fact, you can tell in quite an easy why--try and downlaod an app off google play that is on the Apple store, if it accepts it, then the phone has been jailbroken