Peptidoglycan is a mesh of glycan strands cross-linked by short peptides, and building it depends on penicillin-binding proteins (PBPs), the transpeptidases that form those peptide cross-bridges. Beta-lactams, including penicillins and cephalosporins, are structural analogs of the terminal D-alanyl-D-alanine of the peptide stem. They acylate the active-site serine of the PBP and form a stable covalent penicilloyl-enzyme complex, so the cross-linking reaction stops. Glycopeptides such as vancomycin work one step earlier: they bind the D-Ala-D-Ala terminus itself by hydrogen bonding and physically block the transpeptidase and transglycosylase from reaching the substrate.
Either way, the wall loses its mechanical strength. Because the bacterial cytoplasm is hypertonic relative to the surrounding medium, water enters and the internal pressure rises. A wall that cannot keep pace with growth and division ruptures, and the cell lyses. That is why beta-lactams and glycopeptides are bactericidal against susceptible, actively growing bacteria: the drug does not simply stop a reaction, it removes the structure that resists osmotic pressure.