Go step by step and test.
1. Restart your Router.
Startup in Safe Mode, launch Safar and test.
Restart normally by clicking the “Restart” button at the bottom.
Start up in Safe Mode. https://support.apple.com/en-us/HT201262
2. Disable all extensions and test.
Section: Manage extensions:
https://support.apple.com/guide/safari/use-safari-extensions-sfri32508/mac
3. Safari > Preference > Advanced
Checkmark the box beside "Show Develop menu in menu bar".
Develop menu will appear in the Safari menu bar.
Click “Develop” to show the dropdown.
Click "Empty Caches" from the dropdown and test.
https://support.apple.com/guide/safari/use-the-safari-develop-menu-sfri20948/mac
4. Safari can’t open a website: https://support.apple.com/guide/safari/if-you-cant-open-a-website-ibrw1071/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.