What OS version and Safari version are you using?
Safari/Preferences/Advanced - enable the Develop menu, then go there and Empty Caches. Quit/reopen Safari and test. Then try Safari/History/Show History and delete all history items. Quit/reopen Safari and test. You can also try try Safari/Clear History…. The down side is it clears all cookies. Doing this may cause some sites to no longer recognize your computer as one that has visited the web site. The following won't work in OS Mojave. Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J. When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Select Library/Caches/com.apple.Safari/Cache.db and move it to the trash.
Go to Safari Preferences/Extensions and turn all extensions off. Quit/reopen Safari and test. If okay, turn the extensions on one by one until you figure out what extension is causing the problem.
You may have adware/malware installed. Try downloading this program which was written by Thomas R, a long time poster. The program will search for malware/adware. The program will do the work for you which makes it easy. It may be necessary to run more than one scan. After running the scans, restart the computer.
Malwarebytes Anti-Malware for Mac 10.10 and later
Malwarebytes uninstall
Try setting up another admin user account in System Preferences/Users & Groups to see if the same problem continues. Please post back on whether or not this worked. Also try the Safe Mode. Please post back on whether or not this worked.
Isolating an issue by using another user account
Safe Mode - About
If it works in the Safe Mode, try running this program when booted normally and then copy and paste the output in a reply. The program was created by Etresoft, a frequent contributor. Please use copy and paste as screen shots can be hard to read. Click “Share Report” button in the toolbar, select “Copy to Clipboard” and then paste into a reply. This will show what is running on your computer. No personal information is shown. If the log won’t post, try posting it in Pastebin and provide a link in a reply. After pasting the report in a PasteBin page, go to the top of the page, and copy the address in the URL bar. Paste that in a new reply. Pastebin
Etrecheck – System Information