Helicobacter pylori, the world’s most common chronic infection-causing pathogen, is responsible for causing gastric ulcers, the fourth-leading cause of cancer-related death globally in 2020. In recent years, the effectiveness of the current treatment regimen (two antibiotics and one proton pump inhibitor) has often been plagued with problems such as resistance and the undesired elimination of commensal bacteria. Herein, we report the synthesis of block and random copolycarbonates, functionalized with cationic guanidinium and anionic acetate functional groups, aimed at selectively killing H. pylori in the acidic environment of the stomach, while remaining nontoxic to the commensal bacteria in the gut. The compositions of the polymers were fine-tuned so that the polymers were readily dispersed in water without any difficulty at both pH 3.0 and 7.4. The self-assembly behavior of the polymers at different pH values by dynamic light scattering showed that the random and block copolymers formed stable micelles in a simulated gastric environment (pH 3.0) while aggregated at pH 7.4. Both polymers demonstrated stronger antibacterial activity against H. pylori than the guanidinium-functionalized homopolymer without any acetate functional group at pH 3.0. The block copolymer was significantly more bactericidal at pH 3.0 across the concentrations tested, as compared to the random copolymer, while it did not show significant toxicity toward rat red blood cells (rRBCs) and HK-2 cells or bactericidal effect toward E. coli (a common gut bacterium) and nor caused aggregation of rRBCs at its effective concentration and at physiological pH of 7.4. Additionally, both the block and random copolymers were much more stable against hydrolysis at pH 3.0 than at pH 7.4. This study provides insight into the influence of both polymer architecture and dynamic assembly on the bioactivities of antimicrobial polymers, where the disassembly of coacervates into narrowly dispersed micelles at pH 3 make them potent antimicrobials aided by the protonated carboxylic acid block.