In the situation you describe, that being the referee impeding a player, the referee has no obligation to stop play or provide compensation to either the attacking or defending team.
Law 9 of the FIFA Laws of the Game state:
Ball Out of Play
The ball is out of play when:
Ball In Play
The ball is in play at all other times, including when:
it rebounds off a goalpost, crossbar or corner flagpost and remains in the
field of play
it rebounds off either the referee
So, there is nothing that states explicitly that the ball is out of play in the event of a collision.
Now, if we look at the interpretation of the rule, we have the bullet above which states "play has been stopped by the referee". So we ask, should the referee stop play?
The answer is "No". The referee is deemed as part of the field of play. A player colliding with the referee is, for all intents and purposes, the same as a player colliding with the post, tripping over on the grass or catching his foot on the corner flag.
One exception to this would be if the player was substantially injured (such as a head injury). The referee would then use his discretion to stop the play if desired.
In summary, the referee will do his best to keep out of the way of the ball and players but, if he does collide with the ball or a player, play shall continue.