Adjust your aim, and stabilize your stance.
When you practice around the green, don’t just put the ball in perfect lies all the time. Simulate conditions you’ll find on the course, including difficult lies.
Most players have trouble when the ball is above or below their feet. From a sidehill lie, the ball will follow the direction of the slope, and you have to allow for that.
When the ball is below your feet, it will bounce and run to the right, so aim left. Stand slightly closer to the ball, and set your weight left and more on your heels. Bend more at the waist, grip the club at its full length and swing easier to adjust for the longer arc.
When the ball is above your feet, it’s going to go left, so aim right. Stand slightly farther from the ball, and set your weight left but more on your toes to keep your balance. Grip down on the club, and swing a little harder to make up for the shorter swing arc.
From severe sidehill lies, especially with high-lofted clubs, aim farther left or right.
Ball below feet: Aim left of your target, and swing easier.
Ball above feet: Aim right of your target , and swing harder.