You need earlier shot preparation, and don't wait for the ball to get to you before you start swinging.
for me, once the ball crosses the net, I've already taken my racquet back. Once the ball is about 10 feet in front of me, I'm already swinging.
By the time my racquet head is out in front of me, I'm contacting with the ball about 2 or so feet, or 2:00 on a clock face if I was standing right in the middle of a clock.
Most amateurs don't start swinging the racquet until the ball is practically on them, so their contact point is right on their side, completely lateral to their body. It's a big reason why many shots turn out to be pop flies instead of low over the net.