Installing a third party security app
Apple designed the iPhone’s software (iOS) in such a way that it is very difficult for malware, including viruses, to penetrate its defences. iPhone apps are sandboxed, an app can not access the data of another app, and iOS has several built-in security features to protect your device from malware threats. Meaning you do not need to install an antivirus app on iPhones and iPads.
But do consider installing a third party security app, because iOS security apps cannot act as traditional “antivirus” scanners, while antivirus is only one type of the many threats that exist today. The built-in security apps can not protect your phone from other threats, like phishing emails disguised as Apple ID alerts, and iPhone malware does exist.