A difficult task can make distractions easier to ignore
A hard visual task can use most of the brain's available attention, leaving less capacity for irrelevant sights and sounds. An easy task leaves more attention free, so distracting information is more likely to get through.