Foreign Secretary Liz Truss has warned Russia that invading Ukraine would lead to a terrible loss of life like the Soviet takeover of Afghanistan.
In a speech in Sydney, Ms Truss accused Russia of wanting to recreate the Soviet Union - and urged President Vladimir Putin to step back.
Her warning came ahead of talks between the US and Russia.
Russia denies it is planning an invasion but has moved 100,000 troops near to its border with Ukraine.
It has seized Ukrainian territory before - Crimea, in 2014 - and the head of the military alliance Nato has warned there is a real risk of a fresh conflict in Europe.
President Vladimir Putin has made a series of demands to the West, insisting Ukraine should never be allowed to join Nato and that Nato abandons military activity in eastern Europe.
Nato's 30 members - including the UK, US and several former Soviet Union states which share a border with Russia - agree that an armed attack against one is an attack against them all, and they will come to the aid of one another.
Speaking on Friday, Ms Truss said: "We are very clear, together with our allies in the G7, with our allies in Nato, that if there is an incursion by Russia into Ukraine, it would come at a massive cost.
"We are prepared to put very severe sanctions in place," she said, and added that the UK was already supporting Ukraine with defence.
Prime Minister Boris Johnson and German Chancellor Olaf Scholz discussed Ukraine during a phone call on Thursday evening. Downing Street said they agreed further "military aggression" would come at a "high cost" for Russia.
Earlier this week, Britain announced it was supplying Ukraine with extra troops for training and defensive weapons.
Dozens of British troops have been in Ukraine since 2015 to help train its armed forces, and the UK also promised to help rebuild Ukraine's navy following Russia's invasion of Crimea.
In her speech, Ms Truss said President Putin must "desist and step back from Ukraine before he makes a massive strategic mistake".
"The Kremlin haven't learnt the lessons of history," she said. "They dream of recreating the Soviet Union, or a kind of greater Russia, carving up territory based on ethnicity and language. They claim they want stability while they work to threaten and destabilise others."
And she warned that an invasion would "only lead to a terrible quagmire and loss of life, as we know from the Soviet-Afghan war and conflict in Chechnya".
The Soviet war in Afghanistan stretched throughout the 1980s. Some 15,000 Red Army soldiers and more than a million Afghans were killed and the country was left in ruins.
Ms Truss - who is in Australia to boost ties with the country - added: "We need everyone to step up. Together with our allies, we will continue to stand with Ukraine and urge Russia to de-escalate. What happens in Eastern Europe matters for the world."
Ukraine's ambassador to the UK, Vadym Prystaiko, said he still believed there was "a slight possibility" that a "catastrophe" could still be averted.
But he told the BBC: "Sooner or later Putin will have to do something: either withdraw or move ahead."
Russia seized and annexed the Crimean peninsula in southern Ukraine in 2014, and since then Ukraine's military has been locked in a war with Russian-backed rebels near Russia's borders.
Mr Prystaiko said Russia's latest actions had already succeeded in diverting attention away from the ongoing conflict.
He said he understood Russia's fears about Nato expansion into eastern Europe, but said Ukraine's primary concerns were for their own people and Nato's military alliance was "the best we can have in this part of the globe".
Asked whether Ukraine would join Nato, he said: "One day, we will."
Ministers from key European countries have also been holding talks this week aimed at co-ordinating a Western strategy over the issue.
US Secretary of State Antony Blinken met his Russian counterpart Sergei Lavrov in Geneva earlier.
Speaking to reporters afterwards, Mr Lavrov said the discussion was open and useful, adding that he hoped emotions would cool after the "frank" talks.
He said Russia had never threatened "the Ukrainian people", adding that Moscow was concerned "not about imaginary threats but about real facts", including the West sending arms and military instructors to Ukraine.
Mr Blinken said the US and its allies were prepared to look at addressing Russia's security concerns, but only if Russia did the same.
He said Russia now faced a choice: "It can choose the path of diplomacy that can lead to peace and security, or the path that will lead only to conflict, severe consequences, and international condemnation."
The US was ready to "meet Russia on either path", he said, and would continue to stand with Ukraine. The pair agreed to further discussions in the coming weeks.
On Thursday, US President Joe Biden was criticised by Ukraine's president for comments he made.
Mr Biden had suggested that the West might react with a weaker response if Russia launched a "minor" attack - but Ukraine's President Volodymyr Zelensky rebuked: "There are no minor incursions."
Russia's president has long claimed that the US broke a guarantee it made in 1990 that Nato would not expand further east. "They simply deceived us!" he complained at last month's news conference.
Interpretations differ over what exactly was promised to the then-Soviet leader, Mikhail Gorbachev. But it is clear that Mr Putin believes the guarantee was made.
Since then, several central and eastern European countries, which used to be part of the Soviet Union or its sphere of influence, have joined Nato. Four of them - Poland, Lithuania, Latvia and Estonia - have borders with Russia.
Russia argues that this expansion, and the presence of Nato troops and military equipment near its borders, is a direct threat to its security.
The country seized and annexed the Crimean peninsula in southern Ukraine in 2014 after Ukrainians overthrew their pro-Russian president. Ever since, Ukraine's military has been locked in a war with Russian-backed rebels in areas of the east near Russia's borders.
There are fears that the conflict, which has claimed 14,000 lives and caused at least two million people to flee their homes, may reignite and that Russia's military will cross the border.