Update iPhone to the latest iOS version
Restart the iPhone
Delete suspicious apps
Remove unknown profiles and device management settings
Clear Safari history and website data
Check calendar subscriptions for spam events
Remove suspicious browser extensions
Reset network settings
Change Apple ID password
Enable two-factor authentication
Review Apple ID devices and sign out of unknown devices
Restore the iPhone from a trusted backup
Erase all content and settings if needed
Contact Apple Support if problems continue
