The methods of 1H NMR, spectrophotometric titration, mass spectrometry and elemental analysis are applied to determine the selective binding ability of Co(III)- and Zn(II)-coproporphyrins I towards a series of imidazole-based drug molecules with a wide spectrum of pharmacological activity (metronidazole, histamine, histidine, tinidazole, mercazolil, and pilocarpine) in phosphate buffer (pH 7.4) simulating the blood plasma environment. It is shown that in aqueous buffer media, Co(III)-coproporphyrin I, unlike Zn(II)-coproporphyrin I, binds two imidazole derivatives, and the stability of mono-axial Co-coproporphyrin imidazole complexes is two to three orders of magnitude higher than that of similar complexes of Zn-coproporphyrin I. The studied porphyrinates are found to have the highest binding ability to histamine and histidine due to the formation of two additional hydrogen bonds between the carboxyl groups of the porphyrinate side chains and the binding sites of the ligands in the case of histidine and a hydrogen bond between the amino group of the ligand and the carbonyl oxygen atom of the carboxyl group of the porphyrinate in the case of histamine. The structures of the resulting complexes are optimized by DFT quantum chemical calculations. The results of these studies may be of use in the design of biosensors, including those for the detection, control and verification of various veterinary drug residues in human food samples.