In this study, using ultrasonic method, nanoparticles of a new phosphoramide compound and its cobalt nitrate and cadmium nitrate complexes with formula (4-NO2-C6H4NH)P(O)Cl(NH-C5H4N-2) = L (1), Co(NO3)2(L)(CH3OH) (2), Cd(NO3)2(L)(CH3OH) (3) were synthesized and characterized by 31P, 1H, 13C NMR, fourier transform infrared (FT-IR), ultraviolet–visible (UV-Vis), fluorescence spectroscopy, and elemental analysis as well as field-emission scanning electron microscopy (FE-SEM), transmission electron microsopy (TEM), and XRD techniques. The FE-SEM and high-resolution TEM (HR-TEM) analyses showed that particle sizes of the compounds 1–3 are about 20–50 nm. The compounds 1–3 were utilized as dyes for adsorption of light in dye sensitized solar cells (DSSCs) and the efficiencies of the cells were obtained equal to 0.42%, 0.49%, 0.54%, respectively. The analysis of band gap with density functional theory (DFT) calculations revealed that it decreases in the order 1 > 2 > 3, which is in consistent with the band gaps measured from fluorescence spectra. Comparing the conversion efficiencies of the three dyes illustrated that compound 3 with the smallest band gap yields the greatest efficiency.