I was able to do it by first hooking each group of vertices to a separate hook: select, <kbd>CTRL</kbd> + <kbd>H</kbd>, *Hook to New Object*:

[![][1]][1]

Now in *Object Mode* select both hooks, in *Object Constraint Properties* tab [![][2]][2] add a *Limit Scale* constraint and set **Minimum Y** to `1` (perhaps you want to set the maximum too, if you want to move these groups apart).

[![][3]][3]

Then press <kbd>F3</kbd> and type *Copy Constraints to Selected Objects* (or choose it from *Objects* -> *Constraints* menu).

Now with both hooks selected, just press <kbd>S</kbd>, <kbd>Y</kbd> to scale them along Y axis:

[![][4]][4]

  [1]: https://i.sstatic.net/smuyY.gif
  [2]: https://i.sstatic.net/aDMHU.png
  [3]: https://i.sstatic.net/eo9Ax.png
  [4]: https://i.sstatic.net/mSYAm.gif