Chlorpheniramine (CPM) and doxylamine (DOX) are widely used antihistamines frequently detected in aquatic environments and recognized precursors of N-nitrosodimethylamine (NDMA). Although structurally similar, CPM and DOX differ in their electronic substituents: CPM contains an electron-withdrawing chlorine group (EWG), whereas DOX bears electron-donating groups (EDGs), leading to pronounced divergence in reactivity during UV/chlorine treatment. Both compounds were effectively degraded (>90 % within 4 h) in deionized water; however, DOX exhibited faster radical-driven oxidation, while CPM showed slower degradation, particularly in environmental water where aromatic natural organic matter and NH4+ strongly inhibited its removal. NDMA experiments revealed that unoxidized DOX generated higher NDMA than CPM, but this trend reversed after UV/chlorine pretreatment. Oxidation of CPM produced highly nitrosatable amines and persistent chlorinated aromatic fragments, which promoted NDMA formation during subsequent chloramination, especially in NH4+-rich matrices. In contrast, DOX yielded oxygen-containing intermediates with lower nitrosation reactivity, resulting in comparatively modest NDMA formation after oxidation. Cytotoxicity assays using ML-1 murine hepatoma cells showed a significant decrease in viability only for CPM-treated samples, consistent with the formation of chlorinated aromatic byproducts, whereas DOX and its oxidation products exhibited negligible toxicity. Overall, this study demonstrates that substituent-driven electronic effects can fundamentally redirect degradation pathways, NDMA formation, and biological responses of structurally similar pharmaceuticals under UV/chlorine treatment, providing risk-relevant insights into contaminant behavior in complex water matrices.