Angular correlations between heavy quarks provide a unique probe of the quark-gluon plasma created in ultrarelativistic heavy-ion collisions. Results are presented of a measurement of the azimuthal angle correlations between muons originating from semileptonic decays of heavy quarks produced in 5.02 TeV Pb+Pb and 𝑝𝑝 collisions at the LHC. The muons are measured with transverse momenta and pseudorapidities satisfying and |𝜂𝜇|<2.4, respectively. The distributions of azimuthal angle separation Δ𝜙 for muon pairs having pseudorapidity separation |Δ𝜂|>0.8, are measured in different Pb +Pb centrality intervals and compared to the same distribution measured in 𝑝𝑝 collisions at the same center-of-mass energy. Results are presented separately for muon pairs with opposite-sign charges, same-sign charges, and all pairs. A clear peak is observed in all Δ𝜙 distributions at Δ𝜙∼𝜋, consistent with the parent heavy-quark pairs being produced via hard-scattering processes. The widths of that peak, characterized using Cauchy-Lorentz fits to the Δ𝜙 distributions, are found to not vary significantly as a function of Pb +Pb collision centrality and are similar for 𝑝𝑝 and Pb +Pb collisions. This observation will provide important constraints on theoretical descriptions of heavy-quark interactions with the quark-gluon plasma.