An understanding of the structure of Mark's gospel will help explain. Unlike the other accounts of Jesus' life on earth, Mark has greater emphasis on what Jesus did than on what he said. Mark writes with a sense of speed, of movement, of hastening on from one event to the next. It is only when he gets to the final days of Jesus' life that he slows down and goes into more detail about what Jesus said. But in the section you enquire about, Mark continues to give immediacy to what Jesus did. The words, 'suddenly' and 'straightway', appear three times in the previous 36 verses of that chapter.
However, there is no break at all between verse 37 and 38, for after Jesus' statement about receiving a child in his name, "John answered him..." This is John's response to what Jesus had just said. There is no change of subject because John saw the link between the disciples' arguing about who of them was the greatest (vss.33-34), and Jesus using a little child as an example to teach them humility. Here is how the matter is explained in this book. Speaking of the disciples, the author shows how their being called apart by Jesus should affect them:
"They are different in their nature from the world. That is what the
passage in Mk.9:30 to 10:52 shows. There is a distinction, and it is a
distinction in nature." (Mark, p153, John Metcalfe, 2009 reprint)
Notice how half of chapter 9 and all of chapter 10 are included in this matter? There is no break between the two verses mentioned, for those are part of all the other verses involved.
"A new phase begins at Mark 9:30. 'They departed thence'. ...'For he
taught his disciples, and said unto them, The Son of man is delivered
into the hands of men, and they shall kill him...' 'They understood
not that saying, and were afraid to ask him.'
Yet they understood the world's sayings and were not afraid to ask
each other. But he knew all things, and, when he came to Capernaum,
being in the house, he enquired of them what he knew perfectly well:
'What was it that ye disputed among yourselves by the way?' But they
held their peace: for by the way they had disputed among themselves
who should be the greatest...
And he sat down, and called the twelve, and said unto them, 'If any
man desire to be first, the same shall be last of all, and servant of
all.' Now this is the opposite of the driving motive of this world's
society. But it is the distinction of Christ and the gospel. And it
distinguishes those who aspire to a better resurrection.
And he took a child, and set him in the midst of them: and when he had
taken him in his arms he said unto them, 'Whosoever shall receive one
of such little children in my name receiveth me: and whosoever shall
receive me, receiveth not me, but him that sent me.'
...Neither able nor conscious of aspiration to the greatness sought by
the awe-inspiring adults towering over him, the little child was not
only the embodiment of the spirit that was in Jesus, but of the Father
also. Now, here is the distinction of Christ and the gospel.
Reflecting upon the disciples' dispute, and Jesus' embracing the
little child as their example, John is troubled as he recalls an
incident in which the disciples rebuked one who had cast out demons in
Jesus' name, forbidding him because 'he followeth not us.'
But what had been their motive? Evidently John felt it to be the
desire to be the greatest. This gave rise to indignation against one
not deferring to their prominence... nevertheless, 'he that is not
against us is on our part', Mk.9:40. As to the disciples' deeper
motive, the desire to be the greatest, this had been corrected by the
incident of the little child. As to those 'on our part', even if only
giving a cup of water to the disciples, if it were - as the casting
out of demons - 'in my name', none would lack reward. Why not? Because
the disciples 'belong to Christ'.
If one cast out demons 'in my name'; if one give a cup of water to
those who belong to Christ 'in my name'; let the disciples beware...
where on earth, in any society of this world, will submission to such
doctrine be found? It will be found nowhere, save among the 'little
ones'. But these belong to a society other than this world. Yet how
shall such a nature be preserved in them, to whom by nature such
humiliating self-denial is so contrary? By Salt." (Ibid. p156 ff)
When one bears in mind the earlier roadway dispute amongst the disciples, then it becomes clear why Jesus used that little child to illustrate their lack of humility. Then, when John responded the way he did, that betrayed the niggling matter of pride of position the episode of the man casting out demons in Jesus' name had triggered. The exhortation to be like a little child; that to give a cup of water to a little child in Jesus' name was equal to casting out demons in Jesus' name (even if the person was not one of them), joined to shame the disciples about their worldly desire for positions of prominence. This is how Mark skillfully joins those three events together. We look at them disparately to our cost.