All functions and structures develop and change because they affect the biological fitness of the organism. They make it more or less likely that individuals reproduce and contribute genes to the next generation. So, for example, an ability of a frog to survive the bite of its local venomous snake increases its fitness. But if it lives in an area where the snake does not, then it reduces its fitness. This is because it bears the "cost" of a complicated mechanism without getting any advantage in survival and reproduction. It works the other way round, too. Snakes which eat toxic prey have to use ways to survive the prey's toxins. The snake's digestion and metabolism is slower, and they move around more slowly. See rough-skinned newt and garter snake.