You can lock a cursor coordinate and thereby restrict the movement of the cursor by pressing Alt (Windows) or Opt (MacOS) and either X, Y, A, or R/D on the keyboard.
If Guide Lines are active:
•Alt/Opt + X produces a vertical Guide Line.
•Alt/Opt + Y produces a horizontal Guide Line.
•Alt/Opt + A (having defined the Angle value numerically or drawing in a sample direction) produces a corresponding Guide Line.
•Alt/Opt + R produces a Guide Circle whose radius is determined numerically or graphically.
To unlock the constraint, just press the same key combination (e.g. Alt/Opt + X) again.
If Guide Lines are inactive, the locking function works the same way, but you will not see the Guide Lines.
Another way to lock a coordinate during input is to choose the Lock to Guide Line command from the context menu, if you have already snapped to a Guide Line.