Kyiv brought home 189 former captives, President Volodymyr Zelenskiy said, while Russia's defence ministry said 150 Russian servicemen were returning home.
The Russian ministry said the captives had been released in Belarus, Moscow's close ally in the 34-month-old war with Ukraine, and would be transferred to Russia.
Reuters Television footage in Ukraine showed waiting spouses and some servicemen, many wrapped in blue and yellow national flags, weeping openly as they were reunited well after dark outside a building.
"My son is 5 years old now, the last time I saw him he was 2 years old," said Serhii, who was captured by Russian forces at the Azovstal steel mill in the southern port Mariupol, which withstood a siege for nearly three months in 2022.
"That's why my son probably didn't recognise me. I used to have a beard and hair. I lost 20 kg."
For some former captives the return to freedom involved adjustment.
"Even now I'm holding my hands behind my back, it has become a habit of mine," said Roman Borshch, 29. "Now I have to get used to being a free person again."
Video posted by the Russian Defence Ministry showed smiling servicemen on a bus, some calling their families.
"We'll soon be home. How are the children? How is our boy?" said one man.
"I am overwhelmed by emotion," said another. "I still can't quite believe that this has happened, that I am back home, that the ministry made such efforts, that we are remembered and valued."
Zelenskiy thanked United Arab Emirates authorities and other partners for facilitating the swap. The United Arab Emirates acknowledged it helped arrange the exchange.
"The return of our people from Russian captivity is always very good news for each of us. And today is one of such days: our team managed to bring 189 Ukrainians home," Zelenskiy said on Telegram.
Zelenskiy said the returning Ukrainians included soldiers, sergeants and officers from frontline areas and two civilians who had been captured in Mariupol.
Denys Prokopenko, commander of the 12th Special Forces "Azov" Brigade that defended the Azovstal mill, said 11 of his men were among those returning. Prokopenko was brought home in an earlier swap.
The Ukrainian body overseeing prisoner swaps said it was the 59th exchange between the two sides since Russia's February 2022 invasion of its smaller neighbour. The swap brought to 3,956 the number of Ukrainian detainees brought home.
It said those brought home this year included Ukrainian nationals serving what it described as "so-called sentences" imposed by Russian courts for various offences.
In the last swap in October, also carried out with assistance from the United Arab Emirates, Russia and Ukraine each brought home 95 detainees.Â