While adult fungus gnats don’t harm Haworthias, their larvae can feed on roots and stunt plant growth. Fungus gnats are attracted by decaying plant tissues and decomposing organic growing mediums. For seedlings which are often kept in a more humid environment, larvae of fungus gnats can severely damage their roots and cause deaths.
For a heavily infested plant, clean as much of the growing medium out of the roots, even this may tear off some roots. The growing medium removed should be discarded. Remove any rotten plant tissues, and soak the plant in a ~1% hydrogen peroxide solution for ~15 minutes. This kills any fungus gnat larvae and eggs. Rinse the plant in water and let it dry out in a cool and shaded place. After that, follow the rooting process to let the plant recover.
For a lightly infested plant, place yellow sticky traps next to the plants to capture the adults. In addition, mix 1% hydrogen peroxide in the solution in the next several waterings.
An excellent preventative measure is to use a growing medium with less organic components which decompose fast (for example, peat), and wait for the growing medium to approach dryness before watering.