A learned sensory-motor behavior engages multiple brain regions, including the neocortex and the basal ganglia. How these brain regions coordinate to affect sensory selection (for target stimuli) and inhibition (for distractor stimuli) remains unknown. Here, we performed laminar electrophysiological recordings and muscimol inactivation in frontal cortex and dorsolateral striatum to determine the representations within and functions of each region during selective detection performance. From the recording experiments, in deep layers of frontal cortex and dorsolateral striatum we observed similar encoding of sensory and motor features. However, muscimol inactivation of each region resulted in drastically different outcomes. Inactivation of target-aligned striatum substantially reduced behavioral responses to all task stimuli without disrupting the ability to respond, suggesting essential roles in sensory selection. In contrast, inactivation of distractor-aligned frontal cortex increased responses to distractor stimuli, indicating essential roles in distractor inhibition. Overall, these data suggest distinct functions of frontal cortex and dorsolateral striatum in this task, despite having similar neuronal representations.