The 2D–3D crossover and anisotropy of upper critical fields in Nb and NbN superconducting thin films