"Believe on the one who comes after." Baptism aligns one with what they believe and confess. Baptism don't make one believe nor the cause of belief it is the effect of it. it is an action done by one who is saved and believes.
Those in Acts 19:6-7 had to believe on the one who came after. That is why Paul asked to whom were you baptized
3 And he said to them, “Into what then were you baptized?”
So they said, “Into John’s baptism.”
4 Then Paul said, “John indeed baptized with a baptism of repentance, saying to the people that they should believe on Him who would come after him, that is, on Christ Jesus.”
5 When they heard this, they were baptized in the name of the Lord Jesus.
they were not spoken words over them I baptize you in the name of Jesus, but they were baptized in the Holy Ghost which is the baptism of the Lord Jesus as John said:
John 1: 33
33 I did not know Him, but He who sent me to baptize with water said to me, ‘Upon whom you see the Spirit descending, and remaining on Him, this is He who baptizes with the Holy Spirit.’
That is why Paul asked them " “Did you receive the Holy Spirit when you believed?”
They said they did not even hear of the Holy Spirit.
Paul did not ask them where you baptized in Jesus' name which if it was so essential why not just ask that?
Because it was not taught and FYI this is Acts chapter 19 long removed from Acts 2:38 so if this practice of water baptism is Jesus' name was required Paul did not ask that nor say that.
"5 When they heard this, they were baptized in the name of the Lord Jesus. "
when they heard and believed they received the baptism of Jesus in His authority or in his name Paul laid hands on them and the Spirit was manifested.
Scripture reveals that baptism in the name of Jesus is water baptism.
"Can any man forbid water, that these should not be baptized, which have received the Holy Ghost as well as we?
And he commanded them to be baptized in the name of the Lord." Acts 10:47-48
Each and every detailed conversion account reveals both water baptism in the name of Jesus and receiving the Holy Ghost were separate experiences.
Then Peter said unto them, Repent, and be baptized every one of you in the name of Jesus Christ for the remission of sins, and ye shall receive the gift of the Holy Ghost.
For the promise is unto you, and to your children, and to all that are afar off, even as many as the Lord our God shall call.
Then they that gladly received his word were baptized: and the same day there were added unto them about three thousand souls.
Those who believe and obey water baptism in the name of Jesus are promised they will receive the Holy Ghost. Scripture reveals the experience happens although not automatically upon obedience. Acts 8 and 19 reveal this to be true:
Acts 8:12-17 (Samaritans-half Jewish-half Gentile)
But when they believed Philip preaching the things concerning the kingdom of God, and the name of Jesus Christ, they were baptized, both men and women.
Then Simon himself believed also: and when he was baptized, he continued with Philip, and wondered, beholding the miracles and signs which were done.
Now when the apostles which were at Jerusalem heard that Samaria had received the word of God, they sent unto them Peter and John:
Who, when they were come down, prayed for them, that they might receive the Holy Ghost:
(For as yet he was fallen upon none of them: only they were baptized in the name of the Lord Jesus.)
Then laid they their hands on them, and they received the Holy Ghost.
Acts 10:43-48 (Gentiles)
43 To him give all the prophets witness, that through his name whosoever believeth in him shall receive remission of sins.
While Peter yet spake these words, the Holy Ghost fell on all them which heard the word.
And they of the circumcision which believed were astonished, as many as came with Peter, because that on the Gentiles also was poured out the gift of the Holy Ghost.
For they heard them speak with tongues, and magnify God. Then answered Peter,
Can any man forbid water, that these should not be baptized, which have received the Holy Ghost as well as we?
And
he commanded them to be baptized in the name of the Lord. Then prayed they him to tarry certain days.
Acts 11:13-14
And he shewed us how he had seen an angel in his house, which stood and said unto him, Send men to Joppa, and call for Simon, whose surname is Peter;
Who shall tell thee words, whereby thou and all thy house shall be saved.
Acts 19:2-6 (Disciples who did not realize they had to water baptized in Jesus name)
He said unto them, Have ye received the Holy Ghost since ye believed? And they said unto him, We have not so much as heard whether there be any Holy Ghost.
And he said unto them, Unto what then were ye baptized? And they said, Unto John's baptism.
Then said Paul, John verily baptized with the baptism of repentance, saying unto the people, that they should believe on him which should come after him, that is, on Christ Jesus.
When they heard this,
they were baptized in the name of the Lord Jesus.
And when Paul had laid his hands upon them,
the Holy Ghost came on them; and they spake with tongues, and prophesied.