I would disconnect the shifter from the transmission at the transmission. Then try shifting by hand (make sure the engine is off, or the boat tied well if running). If it shifts easily by hand, and it should, the problem is in the linkage or cables.
If it is tough to shift by hand at the transmission, then you have to identify which reverser you have, should be a tag on the Yanmar or bell housing to do so.
If it shifts easily at the trans, then you need to follow the cables back and see if any kinks or bare wires are showing or broken strands at the ends. Could be the shifter in the cockpit. See if they all move easily while not connected.
SHould get you to a spot where you know it will be cheap or expensive (cables/shift or internal to the trans).
If cables, pretty easy to repair, shifter a tad tougher, transmission tougher yet.
Since it is tough both ways, I would suspect cables or linkage binding.
best of luck