Legislation about persons who lack capacity (Mental Capacity Act 2005) is.
What to put in your reference:
Data Protection Act 2018, c. 12. Available at: https://www.legislation.gov.uk/ukpga/2018/12/contents/enacted (Accessed: 4 April 2023).
Mental Capacity Act 2005, c. 9. Available at: https://www.legislation.gov.uk/ukpga/2005/9/contents/enacted (Accessed: 4 April 2023).
When you view an Act using the government website then the title of the Act will include the c. number, for example, c. 12 in the image below.
You only refer to the country of the legislation if it is not UK (eg. specific to devolved nations such as Scotland, or non-UK). Search Cite them Right for more details.
If your information comes from a particular section of an Act of Parliament, you should use section of the Act in your citation, however your reference will be the same as for a whole Act of Parliament
Citation example:
As defined in section 10(2) of the Data Protection Act 2018.
Reference example: