Atrazine is one of the most widely used herbicides, but its persistence in soil and water poses significant risks, necessitating the development of rapid and selective detection methods. A one-dimensional photonic crystal (1D-PC) sensor is proposed, composed of alternating titanium dioxide ( \(\text {TiO}_2\) ) and silicon dioxide ( \(\text {SiO}_2\) ) layers with an embedded defect layer of a molecularly imprinted polymer (MIP) specific to atrazine. The periodic structure provides a photonic band gap (PBG), where the MIP layer introduces a sharp resonant transmission mode. Binding of atrazine molecules alters the MIP’s effective refractive index, producing a measurable shift in the resonant wavelength. Using the transfer matrix method (TMM), the transmission spectra was modeled to evaluate performance metrics such as sensitivity, quality factor, and figure of merit. The results demonstrate a distinct resonance shift with increasing analyte concentration, enabling selective, high-resolution optical detection. Unlike conventional designs, the critical role of oblique incidence in maximizing the Figure of Merit is identified, and a comprehensive tolerance analysis is incorporated to validate the sensor’s practical feasibility against fabrication errors. Compared to complex inverse-opal or porous structures, this planar \(\text {TiO}_2\) / \(\text {SiO}_2\) design offers advantages in fabrication simplicity and integration into compact optical platforms. A foundation for developing low-cost, highly selective photonic sensors for monitoring environmental contaminants is established by this study.