The EU-wide 48 hour limit and the German Arbeitszeitgesetz only apply to employees, not to self-employed persons or freelancers. Thus, it would in principle be legal to have a full-time job and do any amount of freelancing on the side. I'm not sure whether your PhD student position factors into this since it is unpaid.
If you have multiple employers, the sum of working time matters – this is one reason why you have to notify your employers about additional jobs. One employer cannot check your time with another employer, so you should inform them when your shifts change (while employers can assign you shifts, they must consider your personal circumstances).
But self-employment is not employment. If you take this offer, you would act as a German business, perform work in Germany, pay taxes in Germany, but have an UK client. (Assuming your work would be done remotely rather than travelling to the UK to perform your work there). Freelancing would also mean that you'll meet the wonderful world of German bureaucracy, including registering with the Finanzamt, writing invoices, doing accounting, filing taxes, dealing with VAT, and trying to navigate a no-deal Brexit. At least your work likely counts as freiberuflich rather than gewerblich, which would free you from a Gewerbeanmeldung.
Your don't have to seek permission from your employer when taking up a side job, but you must notify them. They can object if your side job would impact your work. This would clearly be the case when working for a competitor, or when your side job would bring you over the working time limit. Since you work in the public sector, there may be additional rules (parts of Beamtenrecht apply to your employment relationship).
While the working time limit does not apply to freelancing, this might still impact your job if you get too little rest, or if you would become unavailable for your main job during normal working hours. Taking up a side job despite an objection could be cause for immediate termination. Note also that you cannot generally use vacation days to work a side job since vacation is intended for recuperation.
To summarize:
- you would not work an UK job, but be employed in Germany and be self-employed in Germany
- the working time limit only relates to employed work, not self-employed work
- your employer may nevertheless be able to object to you taking up another job if it would affect your work