In general, these characters would have been known as the clowns, since, in Shakespeare's day, comic actors were called clowns. Shakespeare wrote for a company of actors, which means that he always knew in advance which actors would probably play which parts, so we can assume that he actually wrote parts for certain actors.
Dogberry and Verges would have been played by two of his company's clowns, so one major purpose that they served was to amuse the audience. This pair have some funny lines, but we can also assume that they created physical humor to go along with their text, since clowns in Shakespeare's day were well known for their physical comedy. This is still true today of many comics, actors like Jim Carey who rely on physicality to create their humor.
But these characters also serve a purpose when it comes to the plot. They are "law and order" in Messina, and they are the ones that apprehend Conrad and Borachio, after Claudio and Don Pedro are duped by Don John into believing that Hero has been unfaithful. Borachio participated in this scheme, and the bumbling Dogberry and Verges (with the Watch) apprehend them. They even try to alert Leonato before the wedding, but he doesn't take them seriously, so it isn't until Hero has been shamed and has"died" that the truth comes out.
So, Dogberry and Verges serve two purposes. As clowns, they are intended to amuse the audience, and as characters in the story, they serve a pivotal purpose in the plot of the play.