In a recent article we presented a model for hadronic rescattering, and some results were shown for pp collisions at LHC energies. In order to extend the studies to pA and AA collisions, the Angantyr model for heavy-ion collisions is taken as the starting point. Both these models are implemented within the general-purpose Monte Carlo event generator Pythia, which makes the matching reasonably straightforward, and allows for detailed studies of the full space–time evolution. The rescattering rate is significantly higher than in pp, especially for central AA collisions, where the typical primary hadron rescatters several times. We study the impact of rescattering on a number of distributions, such as $p_\perp$ and $\eta$ spectra, and the space–time evolution of the whole collision process. Notably rescattering is shown to give a significant contribution to elliptic flow in XeXe and PbPb, and to give a nontrivial impact on charm production.