Intertidal microbial mats are comprised of distinctly colored millimeter-thick layers whose communities organize in response to environmental gradients such as light availability, oxygen/sulfur concentrations, and redox potential. Here, slight changes in depth correspond to sharp niche boundaries. We explore the patterns of biodiversity along this depth gradient as it relates to functional groups of bacteria, as well as trait-encoding genes. We used molecular techniques to determine how the mat’s layers differed from one another with respect to taxonomic, phylogenetic, and trait diversity, and used these metrics to assess potential drivers of community assembly. We used a range of null models to compute the degree of phylogenetic and functional dispersion for each layer. The SSU-rRNA reads were dominated by Cyanobacteria and Chromatiales, but contained a high taxonomic diversity. The composition of each mat core was significantly different for developmental stage, year, and layer. Phylogenetic richness and evenness positively covaried with depth, and trait richness tended to decrease with depth. We found evidence for significant phylogenetic clustering for all bacteria below the surface layer, supporting the role of habitat filtering in the assembly of mat layers. However, this signal disappeared when the phylogenetic dispersion of particular functional groups, such as oxygenic phototrophs, was measured. Overall, trait diversity measured by orthologous genes was also lower than would be expected by chance, except for genes related to photosynthesis in the topmost layer. Additionally, we show how the choice of taxa pools, null models, spatial scale, and phylogenies can impact our ability to test hypotheses pertaining to community assembly. Our results demonstrate that given the appropriate physiochemical conditions, strong phylogenetic, and trait variation, as well as habitat filtering, can occur at the millimeter-scale.