First of all, make sure your smartphone never leaves your sight. In most cases installing spyware on your device requires physical access to the device. So keeping your phone in your possession will help prevent any spyware from being installed.
Also, make sure to lock your smartphone using a secure and unique passcode or password. Also, enable face or fingerprint authentication, which means the device will only unlock for you.