To configure HTTP or Socks proxy in Safari browser on macOS, go to Settings.
In the Advanced section, click the button Change settings.
Follow these steps:
To save the proxy, click the Apply button in the next window.
It should be noted that the proxy is configured directly in the macOS operating system.
If you use a VPN, then an undesirable situation will arise when the traffic first goes to the proxy server and only then to the VPN (chain: proxy + VPN). Although, the best option from the point of view of security and anonymity is the chain: VPN + proxy.
The best solution to solve this problem is to use app Proxifier for macOS or Secure Kit browser extension.