Search results are presented for physics beyond the standard model in final states with two opposite-charge, same-flavor leptons, jets, and missing transverse momentum. The data sample corresponds to an integrated luminosity of 35.9 fb −1 of proton-proton collisions at s = 13 s√=13 TeV collected with the CMS detector at the LHC in 2016. The analysis uses the invariant mass of the lepton pair, searching for a kinematic edge or a resonant-like excess compatible with the Z boson mass. The search for a kinematic edge targets production of particles sensitive to the strong force, while the resonance search targets both strongly and electroweakly produced new physics. The observed yields are consistent with the expectations from the standard model, and the results are interpreted in the context of simplified models of supersymmetry. In a gauge mediated supersymmetry breaking (GMSB) model of gluino pair production with decay chains including Z bosons, gluino masses up to 1500–1770 GeV are excluded at the 95% confidence level depending on the lightest neutralino mass. In a model of electroweak chargino-neutralino production, chargino masses ... mehr as high as 610 GeV are excluded when the lightest neutralino is massless. In GMSB models of electroweak neutralino-neutralino production, neutralino masses up to 500-650 GeV are excluded depending on the decay mode assumed. Finally, in a model with bottom squark pair production and decay chains resulting in a kinematic edge in the dilepton invariant mass distribution, bottom squark masses up to 980–1200 GeV are excluded depending on the mass of the next-to-lightest neutralino.