Phone Portrait Mode vs Real Bokeh: What's Different
Take a portrait mode photo of someone with curly hair or glasses and zoom in on the edges. Around the curls there is usually a thin halo where the sharp background leaks through, or a patch where strands have been blurred away. The gap between an arm and a torso is often still sharp when it should be soft. None of that makes portrait mode bad. It just shows what the phone is doing, which is not what a lens does.
Why a phone can't blur the background with optics
A flagship phone's main camera has a real focal length of about 7 mm, an aperture around f/1.8, and a sensor under 10 mm wide. Full frame is 36 mm wide. Short lens, small sensor: the depth of field is huge, whatever the f-number says. Put someone 1.5 m from a camera like that and everything from roughly 1 m to 2.8 m comes out acceptably sharp. A full-frame camera at 24 mm and f/1.8, framed the same way from the same spot, is sharp from about 1.3 m to 1.7 m. That is about a quarter of the depth. (These come from the standard depth of field formula, so you can check them in the calculator. The exact figures move a little depending on the circle of confusion you assume.)
So the blur in portrait mode can't come from the lens. The phone works out roughly how far away each part of the scene is, using two lenses, the split focus pixels on the sensor, a lidar scanner, or some mix of those, usually helped by a model that knows what a person looks like. Then it blurs whatever the depth map says is far away, in software, and tries to imitate a real lens while doing it. The photo you took was sharp all over. The blur is added afterwards.
Where it goes wrong
The depth map has a much lower resolution than the photo, so edges are a best guess. Fine hair is the classic failure. Glasses are another: the frames are thin and the lenses show the background through them, which confuses a system trying to decide what is near and what is far. Chain-link fences, railings, a hand held up in front of the face, a glass of water, a pram's mesh canopy. All of these can come out with the wrong parts blurred. Pets and objects are hit and miss on a lot of phones, because the models are trained mostly on people.
Software blur also tends to look too even. A real lens blurs a little more with every extra bit of distance, so a fence post five metres behind your subject is softer than the one at two metres, and a tree fifty metres back is softer again. A depth-map blur often has fewer steps than that, and sometimes you can see them: the background looks cut out and pasted onto a blurred layer.
What it does better than a real lens
Nothing misses focus. With a real f/1.4 portrait lens at 2 m your depth of field is a few centimetres, and it is easy to lose an eye. On the phone the whole face is sharp every time and the blur is added around it. You can usually change the strength afterwards, or remove it, and recent iPhones have an f-number slider for exactly that. For one person standing a couple of metres from a reasonably plain background, plenty of people can't tell the difference on a phone screen, and I wouldn't blame them.
Getting a better result
Distance matters in a specific way. On the iPhones that show distance prompts, the usable range has been roughly 2 to 8 feet from the subject, about 0.6 to 2.4 m. Closer and it asks you to move back, much further and the effect fades. Newer models are more forgiving, but if you get a weak or failed blur, check that first.
Use the telephoto lens if you have one. It gives a little genuine optical blur on top of the software, and it stops faces looking stretched, which they do when a wide lens is held at arm's length. The portrait distance guide on our Subject Distance Calculator site has the numbers.
Then move the subject away from the background. That helps in the same way it does with a real lens, because the background has to be much further away than the subject to blur well, and it gives the depth map an easier job. Someone standing against a wall is the worst case for edge errors. Someone standing three metres in front of a hedge is much better. The bokeh guide covers how aperture, distance and focal length combine, and there is a separate post on getting the same look from a cheap kit lens.
Last, turn the blur down. Over-blurring is what gives most portrait mode shots away. A moderate setting looks more like a real lens than the maximum does.
When a real camera is still worth it
Groups with people at different distances, anything that moves, big prints, and awkward edges. Also out-of-focus highlights. A string of lights behind a subject turns into soft discs on a real lens, and they grow smoothly with distance. Software can imitate the discs, but it is still guessing at the geometry. Sensor size comes into all of this too, and a phone is the extreme small-sensor case. The full frame versus crop sensor post goes through what changes as the sensor shrinks.
A quick way to see it for yourself: shoot the same person twice from the same spot, once in portrait mode and once in normal mode on the telephoto lens, with a background at least 4 m behind them. Zoom both to 100% and look at the hair.