What mouse is it? Do you have a link? Is it programmable?
Try this:
xev -event keyboard -event button
# or this
xev
You can also check with evtest, you may need sudo (at least on wayland). Another option is libinput debug-events
https://wiki.archlinux.org/title/Mouse_buttons#Thumb_buttons_-_forward_and_back
https://wiki.archlinux.org/title/Input_remap_utilities