(Exodus 22:29) "Thus shall you do with your ox": Just as with the first-born of an ox, miscarriages exempt (the next birth) from (the laws of) the first-born, so, with the first-born of a human being. Just as with the first-born of a human being you are permitted to redeem the first-born through any Cohein, wherever you wish, so, with the first-born of a beast, you are permitted to give it to any Cohein wherever you wish.
Thus Shall You Do with Your Ox Just
Mekhilta Tractate Kaspa 1:24