In short, the verses are not talking about sacrificing (putting to death in offering) human children, but passing over of the firstborn to the service of God.
The Keil and Delitzsch Biblical Commentary on the Old Testament regarding Numbers 18 states
The practical confirmation of the priesthood of Aaron and his family, on the part of God, is very appropriately followed by the legal regulations concerning the official duties of the priest and Levites (Numbers 18:1-7), and the revenues to be assigned them for their services (vv. 8-32)
According to this biblical law, the first-born of men and of unclean beasts were redeemed according to Numbers 3:47; Exodus 13:12-13, and Leviticus 27:6, Leviticus 27:27.
With the exception of Exodus 13:12, redemption here regarded monetary redemption (5 shekels).
The original owner was, strictly speaking, the redeemer, and paid the money, and the priest was the receiver, to whom it was paid. (See Bible Study Tools - Numbers 18:15)
Animals which were fit for sacrifice were actually offered, the blood being swung against the altar, and the fat portions burned upon it, whilst the whole of the flesh fell to the portion of the priests.
So far as the redemption of human beings was concerned (Numbers 18:16), they were "to redeem from the monthly child," i.e., the first-born child as soon as it was a month old.
With regard to Exodus 13:12-13, the presenting of all firstborn sons and firstborn male animals to the Lord is also discussed in Bible Study Tools.
Exodus 13:12 (Bible Study Tools)
That thou shalt set apart unto the Lord all that openeth the
Or "the womb", as in ( Exodus 13:2 ) , and this phrase, "set apart", explains the word "sanctify" there, and shows that it signifies the separating of such to the use and service of God, causing it to "pass", as the word here used signifies, from a man's own power and use, to be the Lord's only.
Exodus 13:13 (Bible Study Tools)
and all the firstborn of man amongst thy children shall thou redeem;
with the price of five shekels of the sanctuary, and within thirty days of the birth of it, ( Numbers 18:16 )
Exodus 13:14-16 says
14 “In days to come, when your son asks you, ‘What does this mean?’ say to him, ‘With a mighty hand the LORD brought us out of Egypt, out of the land of slavery.
15 When Pharaoh stubbornly refused to let us go, the LORD killed the firstborn of both people and animals in Egypt. This is why I sacrifice to the LORD the first male offspring of every womb and redeem each of my firstborn sons.’
16 And it will be like a sign on your hand and a symbol on your forehead that the LORD brought us out of Egypt with his mighty hand.”