Sulfonamides are among the widespread bacterial antibiotics. Despite this, their quick emergence constitutes a serious problem for ecosystems and human health. Therefore, there is an increased interest in developing relevant detection method for antibiotics in different matrices. In this work, a straightforward, green, and cost-effective protocol was proposed for the preparation of a selective molecularly imprinted membrane (MIM) of sulfamethoxazole (SMX), a commonly used antibiotic. Thus, cellulose acetate was used as the functional polymer, while polyethylene glycol served as a pore-former. The developed MIM was successfully characterized through scanning electron microscopy (SEM), atomic force microscopy (AFM), Fourier transform infrared spectroscopy (FT-IR), X-ray diffraction (XRD), and thermogravimetric analysis (TGA). The MIM was used as a sensing platform in conjunction with a smartphone for optical readout, enabling on-site, selective, and highly sensitive detection of SMX. In this way, a satisfactory imprinting factor of around 3.6 and a limit of detection of 2 ng mL−1 were reached after applying response surface methodologies, including Box-Behnken and central composite designs. Besides, MIM demonstrated its applicability for the accurate and selective detection of SMX in river waters, wastewater, and drugs. Additionally, the MIM was shown to be a valuable sorbent in a solid-phase extraction protocol, employing a spin column setup that offered rapid and reproducible results. Furthermore, the developed sensing platform exhibited notable regeneration properties over multiple cycles and long shelf-life in different storage conditions. The newly developed methodology is of crucial importance to overcome the limitations of classical imprinting polymers. Furthermore, the smartphone-based platform was used to surpass the typically expensive and complicated methods of detection.