You need to remove the 3rd party app that is causing the ads.
Go to the Galaxy Store and download Samsung's "Good Lock" app. Click on the Family tab. Then click on "Nice Catch" to download and install it. "Nice Catch" will show you what app is popping up those ads.
Sounds like one of your apps is spamming your device. You need to uninstall your sketchy apps. This is how people get viruses. Only install official applications. Go through recent apps and delete ones that look weird or suspicious. Sometimes they're customization apps or odd tool apps. Never anything like big names.