The Old Testament describes several types of things that should be avoided, because they are spiritually impure.
Sickness and disease are mostly caused by the spiritual powers of evil. So a person who touched a sick person risked picking up the spirit that caused the sickness. Skin disease was often the first sign that someone was under attack by evil spirits. Therefore, avoiding someone with skin disease was a means of spiritual protection.
When a person dies, the evil spirits they carry look for somewhere to go. They will often move over to those who touch the dead body. Therefore, avoiding dead bodies was a way of avoiding evil spirits.
The law specified a list of impure animals, but impure animals existed before the law was given. Noah took impure animals onto the ark (Gen 7:2,8). That raises and interesting question. Where did they come from? When God finished creating the animals, he said that they were good (Gen 1:24). The answer is that God had given authority on earth to Adam and Eve. They were tricked into submitting their authority to the spiritual power of evil, and then could not get it back.
So during the 1000 plus years between creation and the flood, the spiritual powers of evil had a free hand to work on earth. At first, there were not many people to attack, so they concentrated their power on corrupting and perverting some of the animals and plants. The evil angels do not have the ability to create new species, as God did. However, they could modify the genetic material of existing species to make new ones. The animals that they had modified are referred to as impure.
These impure animals were the work of evil angels, so there was a risk that they were still attached to them. The children of Israel were warned not to eat these animals, as if they did, they might take on the evil spirits that attached to them (Lev 11).
Many of the impure animals are destructive scavengers. They enjoy eating rotten bodies of sick and dead animals. This reflects the nature of the evil spirits that modified them. They also love destruction. They do not have the power to create anything, but they love to scavenge on God’s creation.