Layered material structures play a key role in enhancing electron–electron interactions to create correlated metallic phases that can transform into unconventional superconducting states. The quasi-two-dimensional electronic properties of such compounds are often inferred indirectly through examination of bulk properties. Here we use scanning tunneling microscopy to directly probe in cross-section the quasi-two-dimensional electronic states of the heavy fermion superconductor CeCoIn5. Our measurements reveal the strong confined nature of quasiparticles, anisotropy of tunneling characteristics, and layer-by-layer modulated behavior of the precursor pseudogap gap phase. In the interlayer coupled superconducting state, the orientation of line defects relative to the d-wave order parameter determines whether in-gap states form due to scattering. Spectroscopic imaging of the anisotropic magnetic vortex cores directly characterizes the short interlayer superconducting coherence length and shows an electronic phase separation near the upper critical in-plane magnetic field, consistent with a Pauli-limited first-order phase transition into a pseudogap phase.