The mechanisms of phylogenetic turnover of microbial communities to environmental perturbations in sediments remain unclear. In this study, the molecular mechanisms of phylogenetic turnover, and impact of antibiotics and antibiotic resistance genes (ARGs) on the modification of microbial assemblages were unravelled. We investigated 306 ARGs, 8 transposases, and 4 integron integrases, bacteria, and eukaryotic diversity through high-throughput quantitative PCR and illumina sequencing, 21 antibiotics and 3 tetracycline byproducts. The freshwater and estuary ecosystems were mainly dominated by genus Sulfurovum and colonised by closely related species compared with the estuary (closeness centrality = 0.42 vs. 0.46), which was dominated by genus Mycobacterium. Eighty-six percent of the ecological process in the bacterial community was driven by stochastic processes, while the rest was driven by deterministic processes. Environmental-related concentrations of antibiotics (0.15–32.53 ng/g) stimulated the proliferation of ARGs which potentially modulated the microbial community assembly. ARG acquisition significantly (P < 0.001) increased eukaryotic diversity through protection mechanisms. ARGs showed complex interrelationships with the microbial communities, and phylum arthropods and Nematea demonstrated the strongest ARG acquisition potential. This study provides key insights for environmental policymakers into understanding the ecological impact of antibiotics and the role of ARGs in modulating the phylogenetic turnover of microbial communities and trophic transfer mechanisms.