Context : An accurate characterization of the known exoplanet population is key to understanding the origin and evolution of planetary systems . Determining true planetary masses through the radial velocity ( RV ) method is expected to experience a great improvement thanks to the availability of ultra-stable echelle spectrographs . Aims : We took advantage of the extreme precision of the new-generation echelle spectrograph ESPRESSO to characterize the transiting planetary system orbiting the G2V star K2-38 located at 194 pc from the Sun with V \sim 11.4 . This system is particularly interesting because it could contain the densest planet detected to date . Methods : We carried out a photometric analysis of the available K2 photometric light curve of this star to measure the radius of its two known planets , K2-38b and K2-38c , with P _ { b } =4.01593 \pm 0.00050 d and P _ { c } =10.56103 \pm 0.00090 d , respectively . Using 43 ESPRESSO high-precision radial velocity measurements taken over the course of 8 months along with the 14 previously published HIRES RV measurements , we modeled the orbits of the two planets through a Markov Chain Monte Carlo ( MCMC ) analysis , significantly improving their mass measurements . Results : Using ESPRESSO spectra , we derived the stellar parameters , T _ { eff } =5731 \pm 66 , \log g =4.38 \pm 0.11 dex , and [ Fe / H ] =0.26 \pm 0.05 dex , and thus the mass and radius of K2-38 , M _ { \star } =1.03 ^ { +0.04 } _ { -0.02 } M _ { \oplus } and R _ { \star } =1.06 ^ { +0.09 } _ { -0.06 } R _ { \oplus } . We determine new values for the planetary properties of both planets . We characterize K2-38b as a super-Earth with R _ { P } =1.54 \pm 0.14 R _ { \oplus } and M _ { p } =7.3 ^ { +1.1 } _ { -1.0 } M _ { \oplus } , and K2-38c as a sub-Neptune with R _ { P } =2.29 \pm 0.26 R _ { \oplus } and M _ { p } =8.3 ^ { +1.3 } _ { -1.3 } M _ { \oplus } . Combining the radius and mass measurements , we derived a mean density of \rho _ { p } =11.0 ^ { +4.1 } _ { -2.8 } g cm ^ { -3 } for K2-38b and \rho _ { p } =3.8 ^ { +1.8 } _ { -1.1 } g cm ^ { -3 } for K2-38c , confirming K2-38b as one of the densest planets known to date . Conclusions : The best description for the composition of K2-38b comes from an iron-rich Mercury-like model , while K2-38c is better described by an rocky model with a H2 envelope . The maximum collision stripping boundary shows how giant impacts could be the cause for the high density of K2-38b . The irradiation received by each planet places them on opposite sides of the radius valley . We find evidence of a long-period signal in the radial velocity time-series whose origin could be linked to a 0.25-3 M _ { J } planet or stellar activity .