Having your hands in the correct position as well as standing the correct length away from the ball can prevent shanks. If done wrong, it can lead to shanks.
When your hands get further away at impact than they were at address, a shank will likely be the result.
If you stand too close to the ball, it will be easier to open the clubface too much leading to a shank. It also increases your chances of hitting the ball with the heel of the club.
If you stand too far back from the ball, you will be reaching to try and compensate which can lead to being unbalanced and to a shank. Your hands will also be in an awkward position.
Your arms should be able to hang naturally at address and you should have a gap of an “open hand’s width between your thigh and the butt end of the club.”