The three-loop cusp anomalous dimension in QCD and its supersymmetric extensions