Go step by step and test.
1. Power off the router. Unplug it from the wall. Wait a while.
Plug it back in. Power the router on. Wait until all lights are lit properly. It will take a while.
Restart the computer.
Start up in Safe Mode. https://support.apple.com/en-us/HT201262
This will remove some system caches and perform a minor level Disk Repair.
Launch Safari to test.
Once in Safe Mode, click the “Restart” button at the bottom.
Launch Safari holding the shift key down. This will start Safari in Safe Mode.
2. Remove Websites Data
Safari > Preferences > Privacy
“Remove stored cookies and data: Click Manage Website Data,
select one or more websites, then click Remove or Remove All.”
https://support.apple.com/en-us/HT204098
Manage cookies and website data in Safari on Mac
3. Clear browsing history.
https://support.apple.com/guide/safari/clear-your-browsing-history-sfri47acf5d6/mac
4. Empty Caches from Develop menu.
Safari > Preference > Advanced
Checkmark the box beside "Show Develop menu in menu bar".
Develop menu will appear in the Safari menu bar.
Click Develop and select "Empty Caches" from the dropdown.
Safari Develop menu:
https://support.apple.com/guide/safari/use-the-safari-develop-menu-sfri20948/mac
5. Check for adware.
Use the latest release of Malwarebytes for Mac to remove malware/adware, if installed on your Mac.
For instructions: Install Malwarebytes for Mac Uninstall Malwarebytes for Mac
Click the “Scan Now” button. Once done, quit Malwarebytes for Mac.
Restart the computer and relaunch Safari holding the shift key down.