Ultra-compact H ii (UC HII) regions are an important phase in the formation and early evolution of massive stars and a key component of the interstellar medium (ISM). The main objectives of this work are to study the young stellar population associated with the G45.07+0.13 and G45.12+0.13 UC HII regions, as well as the ISM in which they are embedded. We determined the distribution of the hydrogen column density (N(
$\mathrm{H}_2$
)) and dust temperature (
$T_d$
) in the molecular cloud using Modified blackbody fitting on Herschel images obtained in four bands: 160, 250, 350, and
$500\,\unicode{x03BC}\mathrm{m}$
. We used near-, mid-, and far-infrared photometric data to identify and classify the young stellar objects (YSOs). Their main parameters were determined by the radiation transfer models. We also constructed a colour-magnitude diagram and K luminosity functions (KLFs) to compare the parameters of stellar objects with the results of the radiative transfer models. We found that N(
$\mathrm{H}_2$
) varies from
${\sim}3.0 \times 10^{23}$
to
$5.5 \times 10^{23}\,\mathrm{cm}^{-2}$
within the G45.07+0.13 and G45.12+0.13 regions, respectively. The maximum
$T_d$
value is 35 K in G45.12+0.13 and 42 K in G45.07+0.13.
$T_d$
then drops significantly from the centre to the periphery, reaching about 18–20 K at distances of
${\sim}2.6$
and
${\sim}3.7\,\mathrm{pc}$
from InfraRed Astronomical Satellite (IRAS) 19110+1045 (G45.07+0.13) and IRAS 19111+1048 (G45.12+0.13), respectively. The gas plus dust mass value included in G45.12+0.13 is
${\sim}3.4 \times 10^5\,\mathrm{M}_\odot$
and
${\sim}1.7 \times 10^5\,\mathrm{M}_\odot$
in G45.07+0.13. The UC HII regions are connected through a cold (
$T_d = 19\,\mathrm{K}$
) bridge. The radial surface density distribution of the identified 518 YSOs exhibits dense clusters in the vicinity of both IRAS sources. The parameters of YSOs in the IRAS clusters (124 objects) and 394 non-cluster objects surrounding them show some differences. About 75% of the YSOs belonging to the IRAS clusters have an evolutionary age greater than
$10^6$
yr. Their slope
$\alpha$
of the KLF agrees well with a Salpeter-type initial mass function (IMF) (
$\gamma = 1.35$
) for a high mass range (O–F stars,
$\beta \sim 2$
) at 1 Myr. The non-cluster objects are uniformly distributed in the molecular cloud, 80% of which are located to the right of the 0.1 Myr isochrone. The slope
$\alpha$
of the KLF of non-cluster objects is
$0.55\,\pm\,0.09$
, corresponding better to a Salpeter-type IMF for low-mass objects (G–M stars,
$\beta \sim 1$
). Our results show that two dense stellar clusters are embedded in these two physically connected UC HII regions. The clusters include several high- and intermediate-mass zero-age main sequence stellar objects. Based on the small age spread of the stellar objects, we suggest that the clusters originate from a single triggering shock. The extended emission observed in both UC HII regions is likely due to the stellar clusters.