What happens
As the pitcher lifts and strides, the free (non-pivot) foot travels toward the plate. Once that foot swings past the back edge of the pitcher's rubber, the pitcher has passed the point of no return: they are now committed to delivering the pitch to home. The one carve-out is a genuine throw to second base on a pickoff. Swinging the free foot past that edge and then throwing to first or third, or stepping off, is a balk.
Why it's a balk
The back edge of the rubber is a clean, observable line. Making it the commitment point stops the pitcher from using the leg lift as a fake — drawing the runner in and then wheeling to a base. Once the free foot crosses, the runner is entitled to assume a pitch is coming.
How to avoid it
Decide before the leg lift. If the plan is a pickoff to first or third, or to step off, do it before the free foot crosses the back edge of the rubber. Once it crosses, finish the pitch.