Does your final-year GPA matter once you apply for graduate school during your undergradate study?
The linked duplicate question answers your query regarding applications in the US. This answer will address the UK situation.
In the UK, if you haven't graduated and got your final mark yet, your offer of a PhD place and funding will almost certainly be conditional on you finishing your degree with a certain grade. They may specify a certain GPA you need to graduate with, or the equivalent UK degree classification. Since the UK system is less finely graded than in the US, the latter scenario gives you more flexibility.
For example, they may state that you must achieve equivalent to a 2:1 (pronounced &quot;two-one&quot;, aka upper second class) degree. In the UK this means an average of between 60% and 69%. Let's say your GPA is currently 3.5, which might correspond to 68%*, a high 2:1. However, in your final semester it drops to 3.3, which might now correspond to 64%, a middling 2:1. In this imaginary scenario, your drop in GPA didn't correspond to a drop in UK classification, so you would still meet the offer.
However, if they give you an offer in terms of your GPA (perhaps less likely), asking for you to graduate with a 3.5 and you drop to 3.3, then you have missed the terms of your offer and your place and funding will likely be rescinded.
Related to Jon Custer's comment, it's also important to note that in the UK the average grade tends to be weighted towards the final year, and first year grades almost never count towards the final classification. So doing poorly in your final year certainly looks bad from a UK perspective, as the final year courses are arguably the most important and have the biggest effect on your overall classification. While that may not be true for your own degree, the unconscious bias may still be in the minds of a UK admissions committee.

*Note that I have no idea how GPA would really be converted to a UK classification; likely the university you are applying to will have their own method of conversion that would definitely be worth asking about before you apply.