The increasing presence of pharmaceuticals and personal care products (PPCPs) in aquatic systems pose significant environmental concerns. This study addresses this issue by synthesizing quaternized mesoporous SBA-15 (QSBA) with varied alkyl chain lengths of C1QSBA, C8QSBA, and C18QSBA. QSBA utilizes dual mechanisms: hydrophobic interactions via the alkyl chain and electrostatic attraction/ion exchange via the ammonium group. Diclofenac (DCF) and acetaminophen (ACT) were selected as target PPCPs due to their contrasting dissociation properties and hydrophobicity, which are the main characteristics of PPCPs. The adsorption of DCF and ACT revealed that longer alkyl chains enhanced the adsorption capacity of ACT through hydrophobic interactions, whereas dissociated DCF (DCF–) adsorption was superior owing to its high hydrophobicity (log Kow = 4.5) and electrostatic attraction. pH levels between 6 and 8 resulted in a high affinity for DCF–. Notably, among the three alkyl chains, only C18QSBA exhibited the most effective adsorption for DCF–. These PPCPs adsorption trends were confirmed through molecular simulations of adsorption under conditions in which competing ions coexisted. The molecular simulations show that while DCF– has lower adsorption energy than Cl−, OH−, and H3O+ ions in QSBA, enhancing its adsorption under various pH conditions. Conversely, ACT exhibits a higher adsorption energy, which reduces its adsorption efficiency. This suggests the potential application of QSBA with long alkyl chains in the treatment of highly hydrophobic and negatively charged PPCPs. Furthermore, this study emphasizes the importance of simulating adsorption under competing ion conditions.