Once most of the stain/paint has been removed ... sand before the last coat of primer goes on, as the primer can raise the grain of the wood. If the surface doesn’t feel smooth to the touch ...