Many organisations choose to collect information on the race, ethnicity and other protected characteristics ( when recruiting new staff. This practice is lawful and it can help employers understand how diverse (or not) their organisation is and if necessary development processes and strategies to maintain and or improve diversity. The Data Act 2018 strictly controls how your personal information is used by organisations, however, you do not have to give this information if you don't want to. Employers are under a duty not to treat you differently because of your age, disability, sex, gender reassignment, sexual orientation, race, religion or belief, or marriage.
See the UK Equality & Human Rights Commission and UK Government's Equality Act 2010 webpages for further information on your rights, what areas are covered by the act and what action you can take if you feel you have been unfairly discriminated against.