Diatomacious earth is fossilized diatoms. It's mostly silica. If you look at it under a microscope, it looks like shards of glass. Food grade has less silica in it, but it can still be abrasive. If it gets inhaled, it can cause irritation in the lungs or other breathing issues.
It can work to kill small insects as long as it's kept dry because of its abrasive qualities. It basically tears them apart.
The qualities above should be a good indicator of why you should not ingest or breathe diatomacious earth and why it doesn't work for internal parasites. It should not be applied externally to your animals either in case it gets inhaled.