  We perform a homogeneous search for and analysis of optical occultations and
phase variations of the most favorable ultra-short-period (USP) ($P<1$~d)
sub-Neptunes ($R_{p}<4 R_{\oplus}$) observed by $\textit{Kepler}$ and K2, with
the aim of better understanding their nature. We first selected 16
$\textit{Kepler}$ and K2 USP sub-Neptunes, based on the expected occultation
signal. We filtered out stellar variability in the $\textit{Kepler}$ light
curves, using a sliding linear fitting and, when required, a more sophisticated
approach based on Gaussian Process regression. We simultaneously modeled the
primary transit, secondary eclipse, and phase variations in a Bayesian
framework, by using information from previous studies and knowledge of the Gaia
parallaxes. We confirm the optical secondary eclipses for Kepler-10b
($13\sigma$), Kepler-78b ($9.5\sigma$), and K2-141b ($6.9\sigma$), with
marginal evidence for K2-312b ($2.2\sigma$). We report new detections for
K2-106b ($3.3\sigma$), K2-131b (3.2$\sigma$), Kepler-407b ($3.0\sigma$), and
hints for K2-229b (2.5$\sigma$). For all targets with the exception of K2-229b
and K2-312b, we also find phase curve variations with a confidence level higher
than $2\sigma$. Two USP planets, namely Kepler-10b and Kepler-78b, show
non-negligible nightside emission. This questions the scenario of magma-ocean
worlds with inefficient heat redistribution to the night-side for both planets.
Due to the youth of the Kepler-78 system and the small planetary orbital
separation, the planet may still retain a collisional secondary atmosphere
capable of conducting heat from the day to the night side. Instead, the
presence of an outgassing magma ocean on the dayside and the low high-energy
irradiation of the old host star may have enabled Kepler-10b to build up and
retain a recently-formed collisional secondary atmosphere.
