The habitat and its environmental conditions, when optimal, influence the reproduction and survival of organisms, since they can have an impact on demographic parameters such as adult sex ratio (ASR), density, and functional traits (morphological, physiological). However, understanding population dynamics and habitat properties can present significant challenges. Few studies evaluate these factors as a whole in contrasting habitats (such as mangroves and grasslands), especially in crab species such as Cardisoma guanhumi. We hypothesized that mangroves would be a favorable habitat for C. guanhumi at a local and regional scale because the environmental conditions (lower temperature, soft and clayey substrate) would have a positive effect on its population dynamics and morphological traits. In order to test this hypothesis, we selected 12 sites on the coasts of the Gulf of Mexico. We found an effect of habitat on ASR, which was male-biased in the mangrove and female-biased in the grassland at a local (by site) and regional scale. Furthermore, crab density was higher in the mangrove and decreased in both habitats as soil hardness increased. In addition, females were heavier and larger (quela, carapace, ventral plate) in the mangrove and these traits were positively related to burrow temperature in this habitat. Our results support the hypothesis that mangroves are the optimal environment for the development of C. guanhumi. This threatened species has thrived in modified habitats such as grasslands, and thus the conservation of these human-dominated habitats is fundamental.