Antifungals work by targeting different components of fungal cells, disrupting their structure or function. For instance, azoles inhibit the synthesis of ergosterol, a key component of the fungal cell membrane. Echinocandins, on the other hand, inhibit the synthesis of glucan, an essential component of the fungal cell wall.