They're safe, blue-light-filtering lenses are passive and harmless, but most toddlers don't really need them, and fit and durability are the bigger concerns. The more important steps at that age are limiting screen time (especially before bed), holding devices farther away, and keeping evenings dim for sleep.
If a toddler does have significant evening screen time, an amber lens could help protect their sleep, but good screen habits matter far more than eyewear for little ones. When in doubt, ask your pediatrician.