  (Abridged) We present a systematic investigation of physical conditions and
elemental abundances in four optically thick Lyman-limit systems (LLSs) at
$z=0.36-0.6$ discovered within the Cosmic Ultraviolet Baryon Survey (CUBS).
CUBS LLSs exhibit multi-component kinematic structure and a complex mix of
multiphase gas, with associated metal transitions from multiple ionization
states that span several hundred km/s in line-of-sight velocity. Specifically,
higher column density components (log N(HI)>16) in all four absorbers comprise
dynamically cool gas with $\langle T \rangle =(2\pm1) \times10^4\,$K and modest
non-thermal broadening of $5\pm3\,$ km/s. The high quality of the QSO
absorption spectra allows us to infer the physical conditions of the gas, using
a detailed ionization modeling that takes into account the resolved component
structures of HI and metal transitions. The range of inferred gas densities
indicates that these absorbers consist of spatially compact clouds with a
median line-of-sight thickness of $160^{+140}_{-50}$ pc. While obtaining robust
metallicity constraints for the low-density, highly ionized phase remains
challenging due to the uncertain N(HI), we demonstrate that the cool-phase gas
in LLSs has a median metallicity of
$\mathrm{[\alpha/H]_{1/2}}=-0.7^{+0.1}_{-0.2}$, with a 16-84 percentile range
of $\mathrm{[\alpha/H]}=(-1.3,-0.1)$. Furthermore, the wide range of inferred
elemental abundance ratios ($\mathrm{[C/\alpha]}$, $\mathrm{[N/\alpha]}$, and
$\mathrm{[Fe/\alpha]}$) indicate a diversity of chemical enrichment histories.
Combining the absorption data with deep galaxy survey data characterizing the
galaxy environment of these absorbers, we discuss the physical connection
between star-forming regions in galaxies and diffuse gas associated with
optically thick absorption systems in the $z<1$ circumgalactic medium.
