Ask professor for reference and at the same time propose to do phd with him? (UK)
Keep the email brief and to the point. If you haven't spoken to him in a while, introduce yourself and tell him what you're doing (1 sentence should suffice).
Explain that you're applying for PhD positions and that you would like him to write a reference for you. It's probably a good idea to mention your research interests and remind him of any projects you worked on together, so he can write an effective reference for you. At this point, you can also ask if he is currently looking to take on a new student, as you're very interested in his research and would like to work with him.
If you do end up applying to work with him, you will need a reference from another academic. There's no point him writing a reference for you which he will then read. He will be able to find out more about you and get the full picture if you have a reference from someone else.
Note that most UK PhDs will require at least 2 references anyway, so you should have at least 3 people in mind who you can ask should the need arise.
Your first email to him may go something like this:
Subject: Reference letter
Dear Professor X,
Hope you are well. I am writing to let you know that I am planning to apply for PhD positions in Y and consequently need some letters of reference. Would you mind writing a reference for me?
It would be helpful if you could mention when you supervised my work on project Z, as this project was very successful and the topic is in line with my current research interests.
On this subject, I noticed that you recently published a paper on topic Z. Are you currently looking to take on a PhD student? If so, I would be interested in applying for the position, as our research interests align well and we had some success with the project I mentioned above.
Many thanks and best wishes,
George Welder