Density function theory (DFT) and time-dependent density function theory (TD-DFT) are used to deduce the structural, electronic, and optical characteristics of hexagonal boron nitride (h-BN), graphene/boron nitride (G/h-BN), and defected graphene/boron nitride (R-G/h-BN) nanostructures. Furthermore, parameters of solar cell sensitizer devices, such as the free energy of electron injection ( \({\Delta G}_{Inj.}\) ) and regeneration ( \({\Delta G}_{Reg.}\) ), light harvesting efficiency (LHE), and open circuit voltage (VOC) were computed. Structural calculations revealed the appearance of the Stone–Wales defect when a carbon atom is removed from the center of nanostructures, facilitating faster electron transfer between the nanostructures and the electrolyte. TD-DFT results deduced a red shift in UV–Vis spectrum from (λmax = 213.84 nm) to (λmax = 372.95 nm) when graphene structure was placed at the center of h-BN nanostructure and to ( λmax = 525.12 nm) for the R-G/h-BN. The photonic parameter results indicated that the proposed nanostructures exhibited a high ability to inject an electron into the conduction band minimum of the TiO2 electrode (CBMTiO2). Moreover, the LHE results demonstrated that the G/h-BN nanostructure exhibited a stronger response to incident light (LHE = 92%) compared to other nanostructures. Furthermore, exhibited ( \({\Delta G}_{Inj.}=-6.646 \text{eV}\) ) a more negative energy compared to ( \({\Delta G}_{Reg.}=-0.315 \text{eV}\) ). The G/h-BN and h-BN nanoislands have suitable stability compared with natural organic, ruthenium, iridium, and platinum complex dyes. Thus, the investigated nanostructures especially h-BN and G/h-BN hold promise for application in solar cell sensitizer devices.