We study different processes responsible for the modification of quarkonia yields in the medium produced in PbPb collisions at √ s N N = 5.02 TeV. The quarkonia and heavy flavour cross sections are estimated using the measurements in pp collisions at LHC energies and shadowing corrections are obtained using the EPS09 parameterizations. A kinetic model is used which incorporates quarkonia suppression inside the Quark Gluon Plasma (QGP), suppression due to hadronic comovers, and regeneration from recombination of heavy quark pairs. The quarkonia dissociation cross section due to gluon collisions, including both color-electric dipole and colormagnetic dipole transitions, has been employed. The regeneration rate is obtained using the principle of detailed balance. The effect of these processes on the nuclear modification factors for both J/ψ and Υ in different ranges of transverse momentum p T and rapidity has been studied for PbPb collisions at √ s N N = 5.02 TeV. The calculations are compared with the available results from LHC experiments. Both the suppression and regeneration due to a QGP are effective in the low and intermediate p T range. The large observed suppression of J/ψ at p T > 10 GeV/c is larger than the suppression expected due to gluon dissociation. PACS numbers: 12.38.Mh, 24.85.+p, 25.75.-q arXiv:1909.10785v2 [hep-ph]