I recently heard that iphones and android style smart phones can double as a gps?

do they work off satellites or do they require internet access to function/ be within cell phone range?

because if they do work with satellites I'm starting to think why bother having a garmin gps handheld etc...?