David Cameron has held talks with Iranian president Hassan Rouhani as part of efforts at the United Nations to break the diplomatic deadlock over Syria.
The crisis dominated their 45-minute discussion in New York, where Western allies remain deeply split with Russia and Iran over the future of Bashar Assad as the civil-war racked country's president.
Russian president Vladimir Putin told the UN General Assembly it would be "an enormous mistake" to refuse to work with the regime - which was "valiantly" fighting the so-called Islamic State (IS) on its territory.
Moscow has recently sent in military reinforcements to Syrian and Mr Putin called for the formation of a "genuinely broad alliance against terrorism, just like the one against Hitler."
Mr Obama - who will later have a rare face-to-face meeting with his Russian counterpart - signalled a new willingness by the West to contemplate a role for Assad in some form of transition that sees him removed from office.
He said he was ready to work with Russia and Iran - which also backs the Damascus government - on a solution.
But he warned there was no alternative to regime change if the extremist threat was to be effectively tackled.
"When a dictator slaughters tens of thousands of his own people, that is not a matter of a nation's internal affairs." The US is prepared to work with any country, including Russia and Iran, to resolve Syria's conflict, Mr Obama said.
Efforts to engage Tehran in a push to end the protracted civil war have been spurred on by a thaw in relations with the West after the signing of a landmark deal over Iran's nuclear ambitions.
A senior UK Government official said the talks with Mr Rouhani had been "good, considered, thoughtful and in a constructive spirit".
Mr Cameron - who yesterday said he wanted to see Assad face trial at the international criminal court - made clear his view that there could be no long-term solution while the Syrian leader remained in power.
But they conceded that there was "clearly still further to go" before any deal could be done that satisfied both camps.
The pair also discussed potential action to cut off the extremists' funding streams - in particular through pressure on nations buying oil from IS.
The Iranian premier earlier told a meeting of scholars and experts: "If we are to succeed in defeating terrorism, the government in Damascus cannot be weakened. It must be able to carry on the fight."
Mr Obama told the annual UN session - which Mr Cameron has chosen not to address, drawing flak from Labour leader Jeremy Corbyn, said: "The United States is prepared to work with any nation, including Russia and Iran, to resolve the conflict.
"But we must recognise that there cannot be, after so much bloodshed, so much carnage, a return to the pre-war status quo."
"Realism dictates that compromise will be required to end the fighting and ultimately stamp out Isil, but realism also requires a managed transition away from Assad and to a new leader."
The conflict has cost more than 250,000 lives, left Europe struggling to deal with a huge influx of refugees and enabled the rise of IS.