Keeping the clubface square depends a lot on your particular swing, so I can’t provide a complete and universal solution to the problem.
I can identify four places where you can get the clubface out of square that do apply, regardless of how you swing the club.
Grip. Use the grip that conforms to how your forearms are structured. See A Basic Golf Swing. If your grip isn’t right, nothing else matters.
Takeaway. The first foot you move your hands away from address is a danger zone, where it is so easy to get your clubface out of square that you will never notice you have done it. You think it must be happening somewhere late in the backswing, but it happened at the very start. If you get your clubface out of square consistently, check that it might be happening here.
Transition. When you start the club back down to the ball, if you try to hit with your hands from from up there, an easy mistake to make, there goes the clubface.
Just before impact. The urge to hit the ball, instead of swinging through it, makes you barrel into the ball with your right hand (left hand, for lefties). There goes the clubface.