In iOS 16 you can lift the subject from an image or isolate the subject by removing the background.
You can see it in action here: https://developer.apple.com/wwdc22/101?time=1101
I wonder whether this feature is also available for developers to use in their own apps. One could probably train a machine learning model and use it with the Vision Framework.
Here's an example on how to implement this, however Apple's solution is already good and I don't want to spent time reinventing the wheel when wehre's a shortcut.