Emergency Brake Dashlight

whenever i’m driving the emergency brake dashlight (as if i have my ebrake down) will randomly pop up and then go away, it’s on and off. never constantly on or off, most often turns on quickly whilst accelerating to highway speeds. My brakes definitely need replacing but could this be why it’s causing it to turn on and off?