The "world's longest flight" has disputed status due to the generality of such a claim. While the distance between two cities is constant, aircraft do not follow a straight path but will adjust the flight path based on headwinds/tailwinds, other weather events, and to avoid flying over certain countries due to politics or war.

By ground distance travelled:

Routings may avoid the shorter ground distance of a great circle route to use tailwinds to save time and fuel, shortening the equivalent still-air distance. The longest flight, by ground distance, is Air India's flight from Delhi to San Francisco, which will sometimes travel up to 15,300 km (8,261 nmi; 9,507 mi) across the Pacific Ocean rather than the 12,395 km (6,693 nmi; 7,702 mi) great circle route, yet saving as much as 2.5 hours travel time due to tailwinds.

More Info: en.wikipedia.org