Hi,
all years/periods spent in UK until Brexit is executed (on March 30, 2019) can be included in meeting the residence requirement of 5 out of last 12 years in 2019.
What will happen with stays in UK after Brexit (March 30, 2019) I don't know for sure. But the danish Government har issued a press release saying that if there will be a "no-deal" Brexit, then there will be adopted a new law about the rights to dagpenge and other social benefits for people where stay in UK before/after brexit will influence their right to benefits/dagpenge.
According to the press release, which we have an danish article about it will be possible to count stays both from before Brexit and after.
Best regards,
Anders Weber, www.a-kasser.dk