Their use when clothing is stored out-of-season gave rise to the colloquial usage of the terms mothballed and put into mothballs to refer to anything which is put into storage or whose operation is suspended.
The idea with both chemicals is to kill moths and moth larvae with the fumes. Both naphthalene and para-dichlorobenzene sublimate, meaning they transition from a solid straight to a gas. The gas is toxic to the moths.
For either of these chemicals to be effective, they need to be placed with the clothing in a sealed container so the fumes can build up and kill the moths. In a sealed atmosphere like this, the fumes are not harmful to people because they are contained. The main threat would occur when opening the containers, or from wearing clothes immediately after opening (especially a problem for infants). A solution is to open the containers outside and let the clothes hang and air out for a day before wearing.
The main concern about the use of mothballs as a snake, mice, or animal repellent is their easy access to children, pets and beneficial animals. Leaving them in a garden or in a living space unprotected makes it very easy for unintended victims such as children, and pets to gain access to them. Mothballs are highly toxic when ingested, causing serious illness or death. In addition to this, overdoing it by using a large quantity of mothballs in a basement or a living space may cause serous respiratory problems in people living in the space. The danger of this happening when using them in this manner becomes very high. Never put mothballs in a place where small children or pets can handle them, sniff them, or possibly eat them.
It has also been suggested that the toxic chemical in mothballs will bond to garden soil, causing permanent damage to it. Research has shown that a weak bond can occur, but naturally occurring soil microbes will break down the toxic component of mothballs over extended periods of time. In addition to this, the toxic effects of mothballs may also kill beneficial soil insects. By far, the risk of using mothballs in the garden involves children, pets such as cats, and other animals accidentally ingesting exposed mothballs.