Studies of the fragmentation of jets into charged particles in heavy-ion collisions can provide information about the mechanism of jet quenching by the hot and dense QCD matter created in such collisions, the quark-gluon plasma. This paper presents a measurement of the angular distribution of charged particles around the jet axis in sNN=5.02 TeV Pb+Pb and pp collisions, using the ATLAS detector at the LHC. The Pb+Pb and pp data sets have integrated luminosities of 0.49nb−1 and 25pb−1, respectively. The measurement is performed for jets reconstructed with the anti-kt algorithm with radius parameter R=0.4 and is extended to an angular distance of r=0.8 from the jet axis. Results are presented as a function of Pb+Pb collision centrality and distance from the jet axis for charged particles with transverse momenta in the 1- to 63-GeV range, matched to jets with transverse momenta in the 126- to 316-GeV range and an absolute value of jet rapidity of less than 1.7. Modifications to the measured distributions are quantified by taking a ratio to the measurements in pp collisions. Yields of charged particles with transverse momenta below 4 GeV are observed to be increasingly enhanced as a function of angular distance from the jet axis, reaching a maximum at r=0.6. Charged particles with transverse momenta above 4 GeV have an enhanced yield in Pb+Pb collisions in the jet core for angular distances up to r=0.05 from the jet axis, with a suppression at larger distances.