You educate yourself, be 100% certain of your identification before eating anything, and always carry a guidebook or other information on your escapades.
Harvesting dandelions is actually beneficial to the ecosystem. Eat the young leaves and flowers raw in salads, or cook the less-tender leaves in a stir fry.
After a warm spring rain, the emerging caps of wild mushrooms are a welcome site to foragers for their health benefits and other diverse uses.
Many berries are pretty distinctive, but make sure you identify them thoroughly, as there are lookalikes abound.