My starting point would be: how about just making Dispel Magic allowed to be cast as a reaction, when specifically targetting a spell being cast?
Bam. Simplest solution. Easy to implement. If you want to make it a little less cut and dry, make it where using dispell magic in that manner results in a contest between the two casters to see if the spell is dispelled or not. No additional rules or mechanics needed.
This has merits, but it probably does not handle extended contests between casters nor the almost certain action denial abilities of multiple casters vs. a single one. This is a critical issue to address because trading an action to deny an action is not, in general, the even trade it appears to be. At the very least the overall contribution of an action to the outcome of a combat must be weighted with what a creature can accomplish with an action, and also its relative contribution to the total ability of one side of the conflict. For example, if 20 weak creatures are fighting 4 strong ones in an otherwise fair fight (i.e. ignoring the action denial abilities in question each side is equally likely to win) it is clear that the worth of 1 action is not equivalent between sides. A contest can be used to help balance out the difference in weight from one creature to another, but it takes no consideration at all of the relative contribution to either side's overall power. If the weak creature has a 20% chance to deny a strong creature's action then in this scenario on average it will be an even trade. The same counterspeller vs. the same caster in a different scenario, however, might have a drastically different cost-benefit analysis.
I'm not saying the game must be written so that the relative contribution of action-denying abilities must adhere to even trades. After all, so much of the emergent tactical depth comes from trying to use these considerations to one's advantage, especially as combat ebbs and flows. Moreover, I want an isolated action that involves only a subset of creatures to have the same distribution of outcomes whenever that same subset is affected, regardless of who else may be in the battle. What I am saying is that I would like the game to be more robust to different numbers of combatants vis-à-vis action economy. This not only mechanically, but with respect to the metagame effects of loss of creature agency, which can have an outsized impact on player enjoyment. A robust game will make sure that the tactically sound options for creatures also tend to increase (or maintain) player engagement. Occasional action loss can be salutary, while frequent action loss trains players to leave the table and grab a frosty beverage. Furthermore, fighting the rules rather than simply using them places a larger burden on the DM, which can negatively influence the game in unpredictable ways.
By leveraging a spell one also introduces quite different counterspelling capabilities depending on who is doing it. That isn't necessarily bad, these differences might be interesting rather than unfortunate, but the secondary effects need consideration. For example, a spontaneous caster will probably be a significantly more flexible counterspeller than a Vancian caster. It would not shock me if at-will dispel magic makes an appearance somewhere in the game, either. It also means creatures without spells that might perform tasks equivalent to counterspelling would need their own methods, reducing the universality of the method.
Finally, it means that counterspelling is a thing that turns on at 5th level or so, and maybe later in practice because at 5th level that spell slot might be the single most valuable resource the creature has. This feels a bit uneven to me within the fiction and also mechanically because the action economy, the principle target of this form of counterspelling, is present in its basic form throughout the entire game. In other words, if counterspelling as action denial is mechanically fine at 5th level, it is probably also fine at 1st level.
Now, dispel magic is a really great choice for some form of counterspelling, I won't deny that. I'm not convinced, however, that it makes a compelling backbone for the same. Of course, I haven't offered a mechanically specific compelling alternative either, so this post emphasizes the "criticism" part of constructive criticism a bit more than I'd like.