How do I restrict my character's movement to one axis?

I don’t know if it helps or not, but on the Character Movement Component there is an option for constraining movement onto a plane, found under the group Planar Movement.

For the duration of the slide, you could just constraint the movement to the plane calculated from the initial direction and position (e.g. Set Plane Constraint from Vectors and Set Plane Constraint Origin).

Keep in mind that constraining the movement in this way is a “hard constraint”, so nothing can move the component out of that plane, including collision. This is something you might or might not want.

P.S.: IMO, this option is mainly used for side-scroller games to avoid pushing the character backward/forward accidentally.