Long- and short-range correlations for pairs of charged particles are studied via two-particle angular correlations in pp collisions at s = 13 TeV and p–Pb collisions at sNN = 5.02 TeV. The correlation functions are measured as a function of relative azimuthal angle ∆φ and pseudorapidity separation ∆η for pairs of primary charged particles within the pseudorapidity interval |η| < 0.9 and the transverse-momentum interval 1 < pT< 4 GeV/c. Flow coefficients are extracted for the long-range correlations (1.6 < |∆η| < 1.8) in various high-multiplicity event classes using the low-multiplicity template fit method. The method is used to subtract the enhanced yield of away-side jet fragments in high-multiplicity events. These results show decreasing flow signals toward lower multiplicity events. Furthermore, the flow coefficients for events with hard probes, such as jets or leading particles, do not exhibit any significant changes compared to those obtained from high-multiplicity events without any specific event selection criteria. The results are compared with hydrodynamic-model calculations, and it is found that a better understanding of the initial conditions is necessary to describe the results, particularly for low-multiplicity events.