Catalyzes the dephosphorylation of phosphoserine (P-Ser). Also catalyzes the hydrolysis of phosphothreonine (P-Thr). H2O + O-phospho-L-serine = L-serine + phosphate H2O + O-phospho-D-serine = D-serine + phosphate Binds 1 Mg(2+) ion per subunit. Can also use other divalent metal cations as Mn(2+), Co(2+) and Zn(2+). Optimum pH is between 6 and 7.5. Amino-acid biosynthesis; L-serine biosynthesis; L-serine from 3-phospho-D-glycerate: step 3/3. Belongs to the HAD-like hydrolase superfamily. SerB family.