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 (PubMed:20519568, PubMed:22654673). 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 (PubMed:22654673). 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. Required from embryogenesis through pupation, even in the absence of galactose. Loss of Gale during pupation leads to defects in fecundity, both in male and female. Gale activity toward UDP-Gal is both necessary and sufficient for male fecundity, but Gale activities toward both UDP-Gal and UDP-GalNAc are required for female fecundity. Eggs may require a more substantial pool of specific UDP-sugar substrates than sperm. Individual loss of one activity or the other later in development results in differential sensitivity to galactose. Both male and female deficient in Gale activity toward UDP-Gal exhibit a reduced lifespan when exposed to galactose; this effect is not seen in flies uniquely deficient in Gale activity toward UDP-GalNAc. Belongs to the NAD(P)-dependent epimerase/dehydratase family.