Other than the USA did any other countries practice a codified form of segregation after abolishing slavery?
Slavery in the Spanish Philippines was abolished gradually over the 18th and 19th centuries. Slaves had included both Moros captured in war and Africans purchased from the slave trade. After the end of slavery, a legally enforced racial caste system persisted until independence from Spain at the end of the 19th century. The caste system involved (among other things) residential restrictions:
Persons classified as blancos (whites) were subdivided into the peninsulares (persons of pure Spanish descent born in Spain); insulares or filipinos (persons of pure Spanish descent born in the Philippines); mestizos de español (persons of mixed Autronesian and Spanish ancestry), and tornatrás (persons of mixed Austronesian, Chinese, and Spanish ancestry). Manila and its arrabales was racially segregated, with blancos living in the walled city of Intramuros, unbaptised sangleys in the Paríán, Catholic sangleys and mestizos de sangley in Binondo, and anything beyond were reserved for indios with the exception of lands in Cebu and several other Spanish posts. Only mestizos de sangley were allowed to enter Intramuros to work as servants for blancos (including mestizos de español) and in various occupations needed for the colony.
But we see how messy this is, like the Casta system of all Spanish colonies. In Spanish countries, there are no racial dichotomies, just very complex caste systems. Anyone not entirely of European descent might have had at least one enslaved ancestor; the grandchildren of a single African or Indio slave could end up in different castes depending on their parentage. So "ex-slave" did not become as clearly mapped onto a single group like it did in the U.S.
In the U.S., due both to the extent of slavery (most blacks having been slaves + no whites having been slaves) and to the starkness of the one-drop rule, it was possible to make a near seamless transition from a free/slave dichotomy to a white/black dichotomy.* The stark American color line led to an equally stark post-emancipation racial caste system.
* Okay, it was somewhat messier than this. I think you need to check state by state to see how Jim Crow laws applied to other minority groups.
South Africa's Apartheid system is probably the most famous example, although they were far from the only former colonial possession in Africa that maintained legal advantages for citizens of European origin into the 20th Century. Under this system only those of entirely European heritage were allowed to vote, all public facilities and schools were segregated, and "mixed" marriages were outlawed as well. This continued in South Africa up until 1994.
The British hooked a similar scheme of racial preferences up to India's Caste system until the 1920's.