The Apollo Lunar Module had the ability to abort landing by dropping the descent stage and firing the ascent engine. So if they had run out of fuel while searching for a safe landing site they still had a safe alternative option.
On the other hand, Apollo had no option than to abort to orbit. Just ditching somewhere and hoping for the best wouldn't have been an option on the Moon, but it's commonly done in aviation on Earth.