Scaling in Z, or any transform of the selected region, will move the vertices shared by the region and the outer rim. Somehow, new vertices must be created on the perimeter of the region which can move independently of the ones on the rim, and new faces created between the region and the rim.
Typically you would do this by E extruding the selected region of faces, and moving the mouse. By default, that will be by translating along the average normal of the region (here, global Z).
But getting the sides to move toward one another by the same amount would be a scale. The Blender way is to use E as before, cancel the subsequent move of the (now independent) faces by right-clicking, and then, with the faces still selected by the operation, S Z scale them toward one another.
Right-clicking after an extrude does not cancel the creation of new faces. It just cancels the move. Without any kind of move , the new faces are still there, hidden. This is a very common cause of errors, so you have to look out for it. Ctrl Z cancels the extrude.