The other answers are correct in where the Unsullied go but miss the explicit quote on the matter. When Jon is walking through the docks, we close on Grey Worm staring at him as he stands by the ships. The Unsullied captain and him have the following conversation where Grey Worm states they are leaving for Naath.
Unsullied Captain: (in Valyrian) All the men have boarded.
Grey Worm: (in Valyrian) Good. We sail for the isle of Naath.
Game of Thrones, Season 8 Episode 6, "The Iron Throne"
This is of course calling back to his promise to Missandei to take her back there when the war was over and protect her people. After her execution and having no one to follow in Westeros he wants to honour her by fulfilling this promise.
Grey Worm: When Daenerys takes her throne there will be no place for us here. I am loyal to my queen. I will fight for her until her enemies are defeated, but when the war is over and she has won, do you want to grow old in this place? Is there nothing else you want to do, nothing else you want to see?
Missandei: Naath. I'd like to see the beaches again.
Grey Worm: Then I will take you there.
Missandei: My people are peaceful. We cannot protect ourselves.
Grey Worm: My people are not peaceful. We will protect you.
Game of Thrones, Season 8 Episode 2, "A Knight of the Seven Kingdoms"
We don't really know what happens to the Dothraki, the only time we see them again (to my knowledge) is when Jon is walking amongst the docks and he has his stare down with Grey Worm. Just before that we see a group of them sidle passed Jon.
Beyond that we don't know where they go. There are two main possibilities though, or a combination of both:
They scatter into Westeros. Dothraki follow strength and now their leader has been killed. This usually results in infighting to find the new Khal or Khals.
Jorah Mormont: This isn't Westeros, where men honor blood. Here they only honor strength. There will be fighting after Drogo dies. Whoever wins that fight will be the new khal. He won't want any rivals. Your boy will be plucked from your breast and given to the dogs.
Game of Thrones, Season 1 Episode 9, "Baelor"
Presumably after this as the Dothraki do not like sailing they would scatter into Westeros and take up land there. Whilst the Westerosi will not like this, their forces have been heavily depleted and a lot don't even have a true ruling Lord/Lady at the moment so they should be able to find home easily enough.
Jorah Mormont: The Dothraki have never crossed the Narrow Sea. They fear any water their horses can't drink.
Game of Thrones, Season 1 Episode 4, "Cripples, Bastards and Broken Things"
They set sail and head home to Essos and Vaes Dothrak. Whilst the above is of course true, they've sailed a few times before and now they have no reason to stay around. We also know that some were seen amongst the docks, potentially headed to a ship. Essos is their homeland, it would be sensible for them to head back there now.