In my institution, the absolute ranking of the candidate is one piece of information that is considered, but often is nowhere near as important as the candidate frankly thinks it is. There are so many other factors that determine whether or not an individual is well suited to a particular area of research that aren't examined by an undergraduate degree. I am sure I could easily find instances of students who came in the top 20% of their degree cohort having many more successful outcomes from their PhD years than those in the top 1%, not least because there are a lot more good students to choose from in the top 20% of the distribution!
Most universities set quality thresholds -- e.g. "you must usually have a 2:i [UK applicant] to be considered for a PhD place" -- which are important to meet. For each candidate meeting these thresholds, we will typically read their application and assign points based on some quasi-arbitrary list of good things (doing well academically gets a point; doing a summer research placement gets a point; publishing papers as an undergraduate and demonstrating that you actually did the work and understood it gets a lot of points, etc) which then form the basis of subsequent discussions.
In my field at least, students who come high up in the year rankings are very good at passing exams; typically they're able to min/max the exam system, do algebra very, very quickly and have a repertoire of "tricks" that have come up in the past. It isn't necessarily the case that any of these skills translate into a successful research career.
Additionally, the type of reference form often sent to your referees have a statement along the lines of "Of all the people I have taught, this person is in the top [50, 25, 15, 5]%" and require the referee to tick the right box. Nobody I know, if they like the person they're writing in support of, ticks anything other than the 5% box (even if they frankly should). The people who read these forms are aware of this.
Finally, as mentioned by all the other posters, year rankings are not comparable across universities, or necessarily within universities. A close friend studied biomedical and electrical engineering at a good university in Belgium and due to an odd set of circumstances involving changing course requirements finished simultaneously first and last in his graduating year!