Catalyzes two distinct but analogous reactions: the reversible epimerization of UDP-glucose to UDP-galactose and the reversible epimerization of UDP-N-acetylglucosamine to UDP-N-acetylgalactosamine. The reaction with UDP-Gal plays a critical role in the Leloir pathway of galactose catabolism in which galactose is converted to the glycolytic intermediate glucose 6-phosphate. It contributes to the catabolism of dietary galactose and enables the endogenous biosynthesis of both UDP-Gal and UDP-GalNAc when exogenous sources are limited. Both UDP-sugar interconversions are important in the synthesis of glycoproteins and glycolipids. UDP-alpha-D-glucose = UDP-alpha-D-galactose UDP-N-acetyl-alpha-D-glucosamine = UDP-N-acetyl-alpha-D-galactosamine Carbohydrate metabolism; galactose metabolism. Homodimer. The disease is caused by variants affecting the gene represented in this entry. Contrary to the human enzyme, the E.coli ortholog (AC P09147) does not catalyze the epimerization of UDP-N-acetylglucosamine to UDP-N-acetylgalactosamine. Compared to the E.coli enzyme, the sugar-binding pocket of the active site is 15% larger for the human enzyme, making it possible to accommodate the acetyl group. Belongs to the NAD(P)-dependent epimerase/dehydratase family.