A built-in Spark SQL function is a factory robot arm: it works on the whole conveyor of rows at once, inside the engine, at full speed. A plain Python UDF is a human hired to inspect each item by hand — and worse, every item must be lifted off the belt, carried to the human's desk, inspected, and carried back (the serialise-to-Python round-trip). For a million rows, that walk to the desk and back is the entire cost. A Pandas UDF at least lets the human inspect a whole crate at a time instead of one screw. Reach for the robot arm first; hire the human only when no robot exists for the job.