Make safari use normal `back` and `forward` button as other browser
macOS doesn't natively support using mouse buttons for forward and back. You can use gestures if you have a Trackpad or magic mouse, but not buttons.
However, there are a number of apps that will do this. One lightweight option is https://sensible-side-buttons.archagon.net/
P.S. I also have a personal fork of this app with some idiosyncratic features I wanted—e.g. hold down the middle mouse button while pressing a side button to use the side button's native behavior. https://github.com/Wowfunhappy/Side-Button-Enabler/releases/tag/1.1