  The production of K$^{*}(892)^{0}$ and $\phi(1020)$ mesons in proton-proton
(pp) and lead-lead (Pb-Pb) collisions at $\sqrt{s_\mathrm{NN}} = 5.02$ TeV has
been measured using the ALICE detector at the Large Hadron Collider (LHC). The
transverse momentum ($p_{\mathrm{T}}$) distributions of K$^{*}(892)^{0}$ and
$\phi(1020)$ mesons have been measured at midrapidity $(|y|<0.5)$ up to
$p_{\mathrm{T}} = 20$ GeV$/c$ in inelastic pp collisions and for several Pb-Pb
collision centralities. The collision centrality and collision energy
dependence of the average transverse momenta agree with the radial flow
scenario observed with stable hadrons, showing that the effect is stronger for
more central collisions and higher collision energies. The $\mathrm{K^{*0}/K}$
ratio is found to be suppressed in Pb-Pb collisions relative to pp collisions:
this indicates a loss of the measured K$^{*}(892)^{0}$ signal due to
rescattering of its decay products in the hadronic phase. In contrast, for the
longer-lived $\phi(1020)$ mesons, no such suppression is observed. The nuclear
modification factors ($R_{\rm AA}$) of K$^{*}(892)^{0}$ and $\phi(1020)$ mesons
are calculated using pp reference spectra at the same collision energy. In
central Pb-Pb collisions for $p_{\rm T} > 8$ GeV$/c$, the $R_{\rm AA}$ values
of K$^{*}(892)^{0}$ and $\phi(1020)$ are below unity and observed to be similar
to those of pions, kaons, and (anti)protons. The $R_{\rm AA}$ values at high
$p_{\mathrm T}$ ($>$~8 GeV$/c$) for K$^{*}(892)^{0}$ and $\phi(1020)$ mesons
are in agreement within uncertainties for $\sqrt{s_\mathrm{NN}} = 5.02$ and
2.76 TeV.
