Could installing the latest iOS update remove malware from iPhone? My iPhone XS running iOS 13.4.1 is infected with malware, although the Block Pop-ups setting is enabled in Safari settings.

I am still getting pop-up Ads saying I made the 5-billionth search. Would upgrading iOS help to remove the malware?
Consider going through the following relevant Apple Support document on how to block pop-up windows and handle persistent ads on Apple devices:


About pop-up ads and windows in Safari


The document contains some very useful tips that go beyond just enabling Block Pop-ups. Notable points are quoted below:


  
  Always make sure you install the latest software updates for all your Apple products. Many software releases have important security updates and may include improvements that help control pop-ups.
  Make sure Safari security settings are turned on, particularly Block Pop-ups—for pop-up windows—and the Fraudulent Website Warning.
  
  On your iPhone, iPad, or iPod touch, go to Settings > Safari and turn on Block Pop-ups and Fraudulent Website Warning.
  If you see an annoying pop-up ad in Safari, you can go to the Search field and enter a new URL or search term to browse to a new site. If you don’t see the Search field on your iPhone, iPad, or iPod touch, tap the top of the screen to make it appear.
  
  Some pop-ups and ads have fake buttons that resemble the close button, so use caution if you try to close a pop-up or ad. If you're unsure, avoid interacting with the pop-up or ad and close the Safari window or tab.