Disentangling collective motion and local rearrangements in 2D and 3D cell assemblies