The longest individual episode, in on-air running time, would be "The Five Doctors", which runs for 90 minutes or 100 minutes for the extended version.
Although each individual story had a separate title, the 23rd season consisted of one story arc in 14 episodes under the umbrella title "The Trial of a Time Lord" and season 16 was one story arc ("The Key to Time") with 6 stories/titles spanning 26 individual episodes. The next longest (under a single title) was "The Daleks' Master Plan" (12 episodes) spanning from Nov. 13, 1965 through Jan. 29, 1966.
Also "Heaven Sent" is set over the space of billions of years making it the episode with the longest amount of fictional time
The longest episode of New Who however, in terms of Run time, would be "End of Time" David Tennant's last episode, the episode has a run time of 3 hours or 180 minutes.