За последние пять дней is correct. However it would be пять последних дней. The first one describes this time span as a whole, and the second one implies every of the last 5 days separately.
Он будет учиться четыре года (в течение четырех лет). Compare: Он уехал на стажировку на четыре года. I think this construction only works with perfective verbs.
Only imperfective verbs here![]()