Exploring high-density QCD matter with the CMS detector at the LHC