Electrons transport (electrical conductivity) in layered materials (e.g. Graphene, MAXene) in out-of plane direction by using quantum tunneling. Quantum tunneling is a phenomenon where electrons can move through barriers that would otherwise be impenetrable. This means that electrons can “tunnel” through the barriers between the layers, allowing electrical conductivity to occur in materials such as graphene, MAXene, and other layered materials.
In addition to the "ideal material" scenario which R. Sagayaraj described, material defects play a large role in reality, so in graphite, you will always have locations in which there are chemical bonds between the layers which may either lower the tunneling barrier or even work as a local electron channel.
Electrons in layered materials such as graphene and MAXene can travel in the direction perpendicular to the plane through a process known as interlayer hopping. This occurs when electrons are transferred from one layer to another, which are weakly connected to each other. In graphene and materials of similar nature, the electrical conductivity in the direction parallel to the plane is mainly attributed to the delocalized pi electrons present in the sp2-hybridized carbon network. However, the distance between the layers in these materials is substantial in comparison to the bond length, leading to a minimal overlap between orbitals in adjacent layers. This results in a weak interlayer interaction and a low rate of interlayer hopping.