A smooth golf ball would fly a short distance before air resistance slows it sharply. A dimpled ball, by contrast, uses added local drag as a tool to reduce total drag and stabilize its path through the air.
Dimples disturb the airflow and force an early transition from laminar flow to turbulent flow in the boundary layer around the ball. That turbulent boundary layer clings to the surface longer before it separates. When separation is delayed, the low pressure wake behind the ball shrinks, and pressure drag drops. The ball pays a small cost in higher skin friction drag but gains a much larger benefit through reduced form drag, the main source of aerodynamic resistance for a bluff body.
The same surface geometry also shapes lift. With backspin, the Magnus effect creates a pressure difference between the upper and lower surfaces. Dimples make that pressure distribution more robust over a range of speeds and spin rates, which keeps the lift force and the aerodynamic center more stable. Lower pressure drag and more predictable lift combine to send a dimpled golf ball both farther and straighter than a smooth one, even though its surface deliberately increases drag in parts of the flow.