  Long- and short-range correlations for pairs of charged particles are studied
via two-particle angular correlations in pp collisions at $\sqrt{s}=13$ TeV and
p$-$Pb collisions at $\sqrt{s_\mathrm{NN}} = 5.02$ TeV. The correlation
functions are measured as a function of relative azimuthal angle
$\Delta\varphi$ and pseudorapidity separation $\Delta\eta$ for pairs of primary
charged particles within the pseudorapidity interval $|\eta| < 0.9$ and the
transverse-momentum interval $1 < p_{\rm T} < 4$ GeV/$c$. Flow coefficients are
extracted for the long-range correlations ($1.6 < |\Delta\eta| <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.
