Modern radar and similar sensors are more than good enough to identify flat landing spots (old lake beds, lava flows, wind-scoured plains, etc.) from orbit. I don't know if we currently have such sensors around Mars - we have some orbiters that are attempting to survey the planet, but perhaps not in such detail as could support finding a landing site - but Starship could presumably carry such as a payload, or several could be launched (perhaps by Falcon 9 or Falcon Heavy vehicles since Starships will presumably remain rare for a while) a few weeks or maybe months earlier than the Starship(s) launch.
Additionally, we have a small but useful amount of Martian surface data already, from landers and especially rovers. While they've probably not specifically been searching for landing sites for a 50m tall 200T (counting payload) vehicle, NASA and other space agencies have amassed considerable information on the immediate surrounds of their landers and rovers. Aiming for such spots might be a bit tricky on a planet with no GPS, but the landing program can permit small alterations in the destination based on terrain, using radar, LIDAR, or similar sensors for fine-grained detail. Starship certainly has the ability for terminal maneuvers before landing; SN8 translated significantly during its flight, rather than just going up and down.
Unmanned Starships could also pilot the way - this is part of the plan - and unload a robot that could set about preparing a landing site. Even if a few of those Starships fail to land safely, all it takes is one with the ability to determine a safe spot for landing, and then ensure that one or more additional safe spots exist in the vicinity.
All of the above is even more true for Luna than for Mars.