That is commonly caused by anti-virus software, so-called "cleaning/tune-up" apps, or incompatible or out-of-date browser extensions. I've never run that stuff and Safari has been stable for me from since v1.
Start by going to Safari Preferences > Extensions tab and turning off any extensions there. Restart Safari and test. If the probelm goes away that confirms it was an extension. You can isolate which one by turning them back on one at a time and testing. If the problem returns, the last one reactivated is the guilty party.
If you are not sure what third-party software is installed, you can post a snapshot of your system configuration so we can check. Fortunately there is a safe and secure way to do that.
A respected and long-serving member of these communities has created a simple utility that will take that "snapshot" of your configuration without revealing any sensitive information about you and your computer. It only runs when you tell it to, not in the background, and therefore creates no performance penalties. It is Etrecheck, and is available here:
Run it and, when its results display, select "Report" from the left-hand pane (scroll down), then click Etrecheck's "Share Report" icon followed by "Copy Report" from the resulting dropdown. Paste the entire report into a response to your own thread here. It will often allow us to quickly identify or eliminate software as the problem. It can also show some hardware issues, like insufficient RAM or a questionable hard drive.