The task users Apple's relatively new "Shortcuts" feature, which allows users to conduct tasks on their phones with a single voice command using Siri.
Apple fanboy Robert Petersen posted a link to the shortcut and an explanation of what it does. Users can download the police shortcut, but must make sure to have the Shortcuts app installed.
Upon saying "Hey Siri, I'm getting pulled over", any music that may be playing is paused and the screen's brightness is dimmed while the phone's "do not disturb" capability is turned on. The phone then automatically sends a message to a contact the user sets up, letting that person know that the user is being stopped by police, along with providing the user's location.
The front camera is then turned on and the phone begins to record video of what is happening. "Once you stop the recording it sends a copy of the video to a contact you specify, puts volume and brightness back to where they were, turns off Do Not Disturb, and gives you the option to send to iCloud Drive or Dropbox", according to a Reddit post by Petersen.
There are apps with similar functions available for Android, including one called "Stop and Frisk Watch", which is designed to record incidents by "simply pushing a trigger on the phone's frame".
It might be easier if police just shoot the iPhone first. It might not stop them getting into trouble but at least they will have done some good for the world.