Based on my experience, there are three reasons I move towards the goalscorer and their entourage after a goal is scored:
- to confirm the number of the goalscorer (not required by the Laws, but may be required by the competition rules); and
- to use presence and body language, and if necessary voice and whistle to direct the player to promptly return to their own half and prevent excessive celebration (as required in Law 12, Section 4, Celebration of a Goal); and
- if either of the above are required, and the temperature or level of the match allows for it, to quietly congratulate the player to build rapport.
If the number of the goalscorer is obvious, and the scorer and friends are promptly returning to their own half, there isn't really any reason to go near them.
1 - I reject the suggestion in other answers that quietly congratulating a player is improper or casts doubt on referee neutrality. While celebrating a goal would be highly inappropriate, telling a player "well done" after scoring a goal is no different to showing genuine concern when a player is injured, or trying to persuade a player to change their behaviour rather than just cautioning them straight away. When used appropriately and sparingly, it may help to build a working relationship between players and referees. This in itself may make player management easier later in the match, or even later in the season if the same team is seen again. This technique may be less appropriate as the level of football increases e.g. elite players may see it as patronising.