Pan Am World Airways Inc. said yesterday it has agreed to sell its valuable and prestigious routes to London's Heathrow Airport to United Airlines Inc. as part of a $400 million deal that also includes a marketing agreement that would more closely link the two carriers.

The sale of the profitable London routes, which may encounter significant regulatory hurdles, would give United a huge boost in its efforts to become one of the dominant global carriers, tripling its nonstop service to Europe. United began its service to Europe in May.

Under the arrangement, the two airlines agreed to allow customers to participate in each others frequent flier programs and coordinate schedules so that United's extensive network of flights help feed passengers into Pan Am's profitable international flights from Miami and Los Angeles to Central and South America. Both carriers yesterday described the agreement as a long-term "liaison" for the two airlines -- beyond a mere financial transaction but short of a merger.

Pan Am President Thomas Plaskett said the arrangement would link "the two airline route systems in what we believe will be one of the largest and most significant alliances of its type in the airline industry."

Under the deal, United will acquire Pan Am's rights to fly between five cities -- New York, Washington, San Francisco, Los Angeles and Seattle -- and London's Heathrow. Only Pan Am and Trans World Airlines now have the right to serve London's largest airport under treaties between the United States and the United Kingdom.

United also would acquire Pan Am's route authority between Dulles and Paris, along with Pan Am's existing facilities at Dulles.

The deal is broken into two parts. One, which involves the sale of two Boeing 747-200 aircraft and Pan Am's facilities at San Francisco International Airport, faces fewer regulatory hurdles and is expected to produce a quick cash infusion of $110 million for Pan Am. The rest of the transaction depends on government approval of the transfer of the Heathrow and other international route authorities, which may meet objections from both the British government and from other U.S. carriers -- particularly American Airlines, which is aggressively expanding its service in Europe.

Pan Am, which ended the second quarter with only $101 million in cash, needs money to survive its seasonal winter decline in revenue, which is complicated this year by the sharp increase in the price of jet fuel. Although the airline expects to receive $150 million Friday for the transfer of its Inter-German Service to Lufthansa Airlines, pension and other obligations are expected to siphon off most of those funds.

Pan Am also hopes to sell its Washington-New York-Boston shuttle, although it now expects to get less than the $250 million it originally anticipated. United is not among the bidders, according to Pan Am. It also was not clear what effect the transaction might have on a marketing alliance between British Airways and United.

Airline industry analysts reacted differently to the news that Pan Am was selling a major piece of its transatlantic service. Some said they viewed it as another step toward the ultimate disappearance of the once proud Pan Am, whose "clippers" were the first passenger planes to cross the Atlantic. Pan Am has been selling off its assets over the last several years, including its once vaunted Pacific routes to United in 1985. But Paul Karos of First Boston Corp., a New York securities firm, said he saw it somewhat more positively. "I think they will be around a lot longer," he said, noting that the size of the transaction may be enough to help the carrier survive until the battered airline industry turns around.