xinput will work under Xorg, but not Wayland.
I actually don't think I've needed to remap mouse buttons on Wayland. Most stuff like that got pushed to the compositor in Wayland. I assume that, given that I'm using sway, sway has some mechanism. Probably Gnome and KDE do too. OP didn't indicate what environment he was in, though.
https://wiki.archlinux.org/title/Input_remap_utilities
Has some packages.