The future opportunities for high-density QCD studies with ion and proton beams at the LHC are presented. Four major scientific goals are identified: the characterisation of the macroscopic long wavelength Quark-Gluon Plasma (QGP) properties with unprecedented precision, the investigation of the microscopic parton dynamics underlying QGP properties, the development of a unified picture of particle production and QCD dynamics from small (pp) to large (nucleus--nucleus) systems, the exploration of parton densities in nuclei in a broad ($x$, $Q^2$) kinematic range and the search for the possible onset of parton saturation. In order to address these scientific goals, high-luminosity Pb-Pb and p-Pb programmes are considered as priorities for Runs 3 and 4, complemented by high-multiplicity studies in pp collisions and a short run with oxygen ions. High-luminosity runs with intermediate-mass nuclei, for example Ar or Kr, are considered as an appealing case for extending the heavy-ion programme at the LHC beyond Run 4. The potential of the High-Energy LHC to probe QCD matter with newly-available observables, at twice larger center-of-mass energies than the LHC, is investigated.