Asking for a date of birth
You can only ask for someone’s date of birth on an application form if they must be a certain age to do the job, for example selling alcohol.
You can ask someone their date of birth on a separate equality monitoring form. You should not let the person selecting or interviewing candidates see this form.
https://www.gov.uk/employer-preventing-discrimination/recruitment#:~:text=You%20can%20only%20ask%20for,interviewing%20candidates%20see%20this%20form.
Indeed - that is from the official site I linked to.
So bottom line is under normal circumstances it is unlawful to ask the age of someone as part of the recruitment process. The primary reason being that age is not a good way to assess whether an
individual meets the requirement for a job and you need to be determining whether the
individual who has applied for a job meets the job spec, not making decisions based on a particular group that this person belongs to, whether that be grouped by age, or sex, or any other protected characteristic.
And that is both the right thing to do in equalities terms, but also the sensible thing to do in recruitment terms - it isn't very smart to exclude someone who may be perfectly capable of doing a job (indeed could be the best candidate) simply because an employer has applied some crude and simplistic (and unlawful) minimum or maximum age requirement. Completely dumb thing for any sensible employer to do.