Fungi play an important role in all kinds of ecosystems because fungi are decomposers. This means that they break down dead plants and animals. Fungi perform this decomposition role because they can break down tough organic materials like cellulose and lignin which invertebrates find difficult to digest. Fungi can also be used in the food production process. Yeast is critical to the baking and brewing processes. Certain fungi are also edible and can be found on something as common on pizza. Finally, fungi can be used to produce medications like penicillin.
As the question states, fungi can be harmful as well, and that is why a person should never eat a fungus unless they are absolutely certain of its safety. Many fungi are extremely harmful when ingested, and symptoms can range from slight gastrointestinal discomfort to death.