Aims. Many extrasolar systems possessing planets in mean-motion resonance or resonant chain have been discovered to date. The transit method coupled with transit timing variation analysis provides an insight into the physical and orbital parameters of the systems, but suffers from observational limitations. When a (near-)resonant planetary system resides in the dynamical neighbourhood of a stable periodic orbit, its long-term stability, and thus survival, can be guaranteed. We use the intrinsic property of the periodic orbits, namely their linear horizontal and vertical stability, to validate or further constrain the orbital elements of detected two-planet systems. Methods. We computed the families of periodic orbits in the general three-body problem for several two-planet Kepler and K2 systems. The dynamical neighbourhood of the systems is unveiled with maps of dynamical stability. Results. Additional validations or constraints on the orbital elements of K2-21, K2-24, Kepler-9, and (non-coplanar) Kepler-108 near-resonant systems were achieved. While a mean-motion resonance locking protects the long-term evolution of the systems K2-21 and K2-24, such a resonant evolution is not possible for the Kepler-9 system, whose stability is maintained through an apsidal anti-alignment. For the Kepler-108 system, we find that the stability of its mutually inclined planets could be justified either solely by a mean-motion resonance, or in tandem with an inclination-type resonance. Going forward, dynamical analyses based on periodic orbits could yield better constrained orbital elements of near-resonant extrasolar systems when performed in parallel to the fitting of the observational data.