(Exodus 22:29) commands: "Thus shall you do with your ox" — referring to the first-born of animals. The Mekhilta draws a comparison between the first-born of animals and the first-born of humans, using this verse to establish parallel rules.
Just as with the first-born of an ox, miscarriages exempt the next birth from the laws of the first-born, so too with human beings. If a woman's first pregnancy ends in miscarriage, her next child is not treated as a halakhic first-born for purposes of the redemption ceremony.
The parallel works in both directions. Just as with the first-born of a human, the father may redeem through any Kohen (a priest), wherever he wishes — he is not restricted to a specific priest or location — so too with the first-born of a beast. The owner may give the first-born animal to any Kohen he chooses, at any location.
The Torah creates this equivalence by placing the laws of animal and human first-borns side by side. "Thus shall you do with your ox" — the word "thus" connects this case to the human first-born discussed nearby, establishing that the same principles govern both categories. The first-born of the herd and the first-born of the family are governed by parallel rules, each illuminating the other. What we learn about one, we apply to the other, creating a unified law of first-born sanctity across species.