Microbial chemotaxis plays a key role in a diversity of biological and ecological processes. Although microfluidics-based assays have been applied to investigate bacterial chemotaxis, retrieving chemotactic cells off-chip based on their dynamic chemotactic responses remains limited. Here, we present a simple three-dimensional microfluidic platform capable of programmable delivery of solutions, maintaining static, stable gradients for over 20 hours, followed by active sorting and retrieval of bacteria based on their chemotactic phenotypes. Using this platform, we revealed the swimming features of individual E. coli cells in response to chemoattractant and observed rapid bacterial adaptation to the gradients. Furthermore, the robust performance of the platform allowed us to investigate complex natural microbial communities. Exemplified by sorting bacteria towards soluble cellulose and lignin compounds, we found only a small percentage (<20%) of chemotactic bacteria from a leaf mould microbiota exhibited cellulolytic or lignin-degradation abilities. These findings highlight that chemotaxis does not always align with degradation abilities. Interestingly, a new Erwinia aphidicola strain was discovered with substantial cellulose degradation capabilities. These results illustrate the strong potential of this microfluidic platform for investigating broad processes involving bacterial chemotaxis and for discovering functional microbes.