Just because birds resemble each other doesn’t mean they’re related.
Flamingos and cranes are both tall birds with long necks and long legs but they come from different branches of the taxonomic tree.
They resemble each other in flight and on the ground.
However flamingos are related to grebes and cranes are related to sandpipers as shown in the phylogenomic supertree below. (Note the purple rectangles that highlight the birds.)
As odd as it seems, here are flamingos and cranes with much closer relatives.
It’s possible to be similar but not related.
Keep this in mind when you look at a hawk and a falcon. They are not closely related either.
(Sandhill cranes in Lawrence County PA by Steve Gosser; pied-billed grebe by Chuck Tague; phylgenomic supertree from MDPI; remaining photos from Wikimedia Commons. Click on the captions to see their origin)