Subterranean and surface habitats are in stark contrast in several environmental factors. Therefore, adaptation to the subterranean environment typically impedes the (re)colonisation of surface habitats. The genus Niphargus includes amphipod crustaceans that primarily occupy subterranean habitats. All its species show typical adaptations to the subterranean environment. However, some Niphargus species occur in surface-subterranean ecotones. To understand whether (i) habitat-based phenotypic divergence is present between the cave and the ecotone species and (ii) similar phenotypes emerge independently in each ecotone, we studied morphological divergence between four cave and four ecotone Niphargus species based on 13 functional morphological traits. To account for different selection acting on the sexes, we included both males (N = 244) and females (N = 222). Nine out of 13 traits showed habitat-divergence. Traits related to feeding and crawling were shorter, while traits related to oxygenation were larger in ecotone species. Eleven out of 13 traits were sexually dimorphic. Traits related to oxygenation and crawling were larger in females, while the trait related to swimming was larger in males. We found that the extent of sexual dimorphism differs between the habitats in eight traits related to sensing, feeding, oxygenation and crawling. Additionally, we found that in certain traits related to sensing and oxygenation, habitat-related differences are only present in one sex, but not the other. We conclude that the detected differences between the cave and the ecotone species indicate divergent evolution, where similarities among the different species within habitat type indicate convergent evolution. The high degree of sexual dimorphism paired with differences in sexual dimorphism between the habitats in certain traits suggest that sexual and fecundity selections have comparable effects to environmental selection. Thus, studies of habitat-dependent adaptations investigating one sex only, or not considering sexual dimorphism, can lead to erroneous conclusions.