Because the planets (and everything else in the solar system) don't travel in circular orbits with the sun at the center of the circle.
They travel in elliptical orbits, with the sun at one focus of the ellipse.
Different points on the ellipse have different distances from the focus where the sun is.