Apple and Google have some simple rules for their API: You can only use it if you are a national health organisation (in the case of the USA each state counts, in the case of the UK there are four), so you and I can't put an app using it on the App Store. And if you use the API, you are not allowed to send location data to anyone.I'm pretty sure going against the UK government is going to explode in Apple's face here.
Apple refusing to add in backdoors to the OS that compromise device security for millions of citizens to find the isolated few criminals is one thing. Refusing to permit government health apps to be installed in a global pandemic is another.
It should be up to users whether they want to compromise on their privacy here, and in particular, they should make that decision by voting for their government officials. As far as I'm aware, the UK is a properly functioning democracy - if their leaders decided this is an acceptable measure to take for health reasons and they're not getting voted out, then it's the will of the people and Apple should stay out of it.
It's up to the UK (or probably England in this case) to decide whether they want to use the API, which means no sending of location data to anyone, or not. Which means no API, and they still have to go through the normal app review process.
And as far as I'm aware, the UK right now may be a democracy, but it is definitely not functioning properly - there is incompetence at an incredible scale. Heaven knows how they ever managed to get Covid vaccinations organised.