The default gestures on the Trackpad for ‘Swipe between pages’ let you navigate ‘back’ and ‘forward’ with just two fingers. And you may be doing these gestures often accidentally (unintentionally). In some apps like Safari, you may even lose the data you may have entered, when you do the gesture mistake.
An easy way to solve this is to make this gesture require three fingers instead of two. Moreover, doing this will automatically change the gesture for ‘Swipe between full-screen apps’ require four fingers.
It is better to start using your Mac this way before you develop the habit of using two fingers for pages and three fingers for apps. Furthermore, the gestures for three fingers instead of two for pages are inverted, so it takes time to build that habit too. Anyway it is more comfortable to use four fingers for apps instead of three.