Heavy metals are typically avoided in cosmetic formulations due to their potential toxicity when absorbed by the skin or body. However, trace amounts of heavy metals may be used as colorants or preservatives in cosmetics following strict regulations and safety guidelines to ensure consumer safety.