When you say popup ads, do these look like system alerts (Grey alerts on the top right of your screen)?
If so, his is a feature of Safari that allows websites to send you notifications.
Here are the steps to get rid of these notification alerts..
1. Open the Safari Settings (Preferences in Monterey or earlier)
2. On top click on Websites.
3. On the left scroll down and select Notifications.
4. Remove everything in the list on the right.
5. Uncheck Allow websites to ask for permissions to send notifications
6. Quit Safari.
7. Restart your Mac.
You should no longer see the alerts.