Catalyzes the interconversion between UDP-glucose and UDP-galactose. UDP-alpha-D-glucose = UDP-alpha-D-galactose Carbohydrate metabolism; galactose metabolism. Belongs to the NAD(P)-dependent epimerase/dehydratase family.