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

You’re still not understanding, which is fine. Please, do this so you can see what I mean, because there’s a conceptual ocean between us.

Replace the skeletal mesh with whatever mesh your character is using. Now, try to walk in a straight line with your character, and pay attention to the X and Y values.

In 3D, you CANNOT arbitrarily change an X or Y value, because, the moment your character moves, they are in X and Y space. If you clip or reduce one of these values, you character will NOT slide in a predictable way.

Again, please do this, so you see what I mean.

(Analogously, in 2D, you can ignore ONE COORDINATE → Y, in 3D, you can ignore ONE COORDINATE → Z, in 4D, you can ignore ONE COORDINATE → W).