Face-centered cubic (FCC, or closest-packed cubic, CCP) and hexagonal close-packed spheres have the greatest (and equal) density of packed spheres, occupying 74.048% of the actual volume. Ref 1
However, because of the different interlaying of the hexagonal, tight packing in two dimensions, the repeating unit, or unit cell, is described differently for each crystal type. While each layer in a FCC crystal is identical to every other layer, and to each layer in a HCP crystal, the different layering makes it possible to distinguish between them, and to identify repeating units. The smallest repeating unit in a FCC crystal contains 4 atoms and can be described with one size parameter. The smallest repeating unit in a HCP crystal contains 6 atoms. Although its density is the same as that of a FCC crystal, it needs 6 atoms to describe its layering. Interestingly, body-centered cubic crystals can be described with only 2 atoms per unit cell, but have a density of only 68% (they are not close-packed). Ref 2
The construction of FCC and HCP crystals is identical for two layers, but the third is differently placed. HCP has only two positions, a and b, but FCC places a third layer c so that the atoms do not lie directly over any in the first or second layer. HCP places layers as a,b,a,b,a,b...; FCC does it this way: a,b,c,a,b,c,a,b,c...
FCC and HCP unit cells are drawn to show aspects of their packing, so interatomic distances (lattice parameters) specified are between differently placed atoms. Comparing heights isn't really comparing repeating units. If you measure the distance between two adjacent atoms in FCC, you will find the same interatomic distance in HCP. However, comparing the distance between more remote atoms can give you different results. It's a bit like comparing your vertical height at age 6 months with your horizontal dimension now. They're similar, but different because you are looking with a different viewpoint.
It's fascinating to consider that crystal structures are energetically distinguishable not just by next-door atoms, but by atoms down the street by one house. Or maybe more!
Ref 1. https://en.wikipedia.org/wiki/Close-packing_of_equal_spheres
Ref 2. https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Supplemental_Modules_(Physical_and_Theoretical_Chemistry)/Physical_Properties_of_Matter/States_of_Matter/Properties_of_Solids/Crystal_Lattice/Closest_Pack_Structures