Electronic and optical properties of 2D models of graphene, boron nitride (BN), silicene, SiC, and phosphorene functionalized with pyrazinamide (PZA), a front line antitubercular chemotherapeutic, are investigated using cluster models and density functional theory with van der Waals dispersion corrections and including solvent effects. PZA favors covalent fuuctionalitation Onto silicene and SiC whereas it is physisorbed onto graphene, BN, and phosphorene at a nearest-neighbor distance >3.0 angstrom and binding energies between -0.7 and -0.8 eV. The analysis of orbital energies, frontier orbitals, density of states, and absorption spectra shows that the HOMO-LUMO gaps for graphene, silicene, and phosphorene remain virtually unchanged upon adsorption, whereas midgap states appear in the BN and SiC clusters. For silicene, Si 2p core level photoemission spectroscopy is the better tool to analyze the chemisorption, of PZA. Our study brings atomistic insight into the structural, electronic, and optical response of 2D materials as selective sensors for pyrazinamide and similar therapeutics for potential drug delivery applications.