If you have problems opening webpages, take a look at these troubleshooting techniques suggested by Apple.
https://support.apple.com/en-us/HT204098
Go to Safari menu (At the very top right side of your screen next to Apple icon), choose "Quit Safari"
press "Shift" button and while holding this button on your keyboard single click on the Safari icon on your Dock.
Open Safari - Preferences - Privacy - Remove All Website Data.
Open the Go menu with Option (Alt) key pressed - Library - locate Safari folder and move it to your desktop. Restart your Mac, open Safari and delete the folder from your desktop.
Also, you may try these steps:
Restart your Mac.
Try Safe Boot:
- Shut down your Mac
- Wait until your computer turns off and after that press the Power button
- Right after you hear the startup tone, press and hold the Shift key
- Release the Shift key when you see a grey Apple sign and the progress bar below this sign
- After your Mac boots up, restart it as you usually do.
Apart from that, take a look at this Apple article and follow the instructions on Resetting NVRAM shown there: How to Reset NVRAM on your Mac - Apple Support
Try resetting the System Management Controller: https://support.apple.com/en-us/HT201295
Hope this helps!