Using classical density functional theory, the liquid crystal (LC)-mediated interaction between a cylindrical nanoparticle and a structured substrate is studied. The surface is structured by cutting a rectangular groove into the surface. In the absence of the nanoparticle, a range of defectstructures is formed in the vicinity of the groove. By varying the groove width and depth, the LC-mediated interaction changes from repulsive to attractive. This interaction is strongest when the groove is of comparable size to the nanoparticle. For narrow grooves the nanoparticle is attracted to the center of the groove, while for wider grooves there is a free energy minimum near the sidewalls.