Hello michal_26,
Thanks for using Apple Support Communities. Since it sounds like the issue is isolated to Safari, we'd recommend starting with the guidance from If an app freezes or quits unexpectedly on Mac which can help with most app-specific issues. Guidance is as follows; keep in mind some of these suggestions will not apply since Safari is an Apple-developed app.
• If an app doesn’t quit as expected or it’s unresponsive, you can force quit the app (you may lose unsaved changes). Choose Apple menu > Force Quit, select the app in the dialogue that appears, then click Force Quit.
• If the app quit, reopen it by clicking Reopen in the dialogue that appears.
• Restart your Mac by choosing Apple menu > Restart.
• Make sure the app is compatible with your version of macOS.
• Open another file in the app. There may be a problem with the original file.
• Check for updates to your software.
• Disconnect any peripheral devices you just connected (for example, a printer). They may not be compatible with your version of macOS.
• Uninstall any app plug-ins or enhancements from other manufacturers.
• If you recently updated the app or macOS, a plug-in or enhancement you installed may no longer be compatible.
• Diagnose problems with your Mac to learn whether hardware you installed, such as additional memory, is incompatible, improperly installed or defective.
It might also help to test in safe mode. Since safe mode prevents some software from loading, it can help narrow down where this occurs. To start up in safe mode, use the following steps from How to use safe mode on your Mac.
Apple silicon
1. Shut down your Mac.
2. Turn on your Mac and continue to press and hold the power button until you see the startup options window.
3. Select your startup disk, then press and hold the Shift key while clicking “Continue in Safe Mode.”
4. Log in to your Mac. You might be asked to log in again.
Intel processor
1. Turn on or restart your Mac, then immediately press and hold the Shift key as your Mac starts up.
2. Release the key when you see the login window, then log in to your Mac.
3. You might be asked to log in again. On either the first or second login window, you should see ”Safe Boot” in the upper-right corner of the window.
Use your results and the remainder of that article to continue.
Kind regards.