Phase transitions in U(N) and SU(N) lattice gauge theories