If you haven't jailbroken your iPhone, it's not possible to have malware.
To keep your Apple ID account secure, see the following Apple articles:
Manage and use your Apple ID
Manage and use your Apple ID – Apple Support (UK)
See who has access to your device or accounts
See who has access to your device or accounts – Apple Support (UK)
Recognize and avoid phishing messages, phony support calls, and other scams
Recognize and avoid phishing messages, phony support calls, and other scams - Apple Support
- If you receive a suspicious email or SMS text message that looks like it's supposed to be from Apple, please email it to reportphishing@apple.com.
Phony "tech support" / "ransomware" popups and web pages
Phony "tech support" / "ransomware" popup… - Apple Community
Identify and filter junk mail in iCloud
Identify and filter junk mail in iCloud - Apple Support
👉 If you think your Apple ID has been compromised
If you think your Apple ID has been compromised - Apple Support
Identify legitimate emails from the App Store or iTunes Store
Identify legitimate emails from the App Store or iTunes Store – Apple Support (UK)
Set up iCloud Keychain
Set up iCloud Keychain - Apple Support
Create a strong password for your Apple ID, It is best if your password consists of eight or more characters and include upper and lowercase letters, and at least one number. You can also add extra characters and punctuation marks to make your password even stronger.
Never provide your password, passcode, security questions, verification codes, recovery key or any other account security details to anyone else. Apple will never ask you for this information.
See also the following Apple articles:
About the 'Trust This Computer' alert on your iPhone, iPad, or iPod touch
About the 'Trust This Computer' alert on your iPhone, iPad, or iPod touch - Apple Support
Authorize or deauthorize your computer for iTunes Store purchases
Authorize or deauthorize your computer for iTunes Store purchases - Apple Support
Get a verification code and sign in with two-factor authentication
Get a verification code and sign in with two-factor authentication - Apple Support
Check your Apple ID device list to see where you're signed in
Check your Apple ID device list to see where you're signed in - Apple Support
- if you see devices that don't belong to you, delete from your account.
Block phone numbers, contacts, and emails on your iPhone, iPad, or iPod touch
Block phone numbers, contacts, and emails on your iPhone, iPad, or iPod touch - Apple Support
Detect and block spam phone calls
Detect and block spam phone calls - Apple Support
Clear the history and cookies from Safari on your iPhone, iPad, or iPod touch
Clear the history and cookies from Safari on your iPhone, iPad, or iPod touch - Apple Support