We are waiting for now the agreement that comes on the UK's exit from the EU (Brexit).
So how stay in UK after Brexit will be treated according to the new residence requirement, we do not know at this moment.
However stay in UK until the Brexit-date (marts 30, 2019) will off course be regarded as stay in EU.
But if you have not stayed in Denmark or another EU/EEA-country (including UK until marts 30, 2019), for at least 5 out of the last 12 years, at the date you apply for benefits - graduation date, then you can not get Unemployment benefits ("dagpenge").
So I dont know if I fully understand how many years you have stayed in EU, but it dosent need to be the last 5-7 years, only 5 out of the last 12 years (if you apply for dagpenge in 2019).
Anders Weber, www.a-kasser.dk