Context. PSR B1259-63/LS 2883 is a gamma-ray binary system consisting of a pulsar in an eccentric orbit around a bright Oe stellar-type companion star that features a dense circumstellar disc. The bright broad-band emission observed at phases close to periastron offers a unique opportunity to study particle acceleration and radiation processes in binary systems. Observations at gamma-ray energies constrain these processes through variability and spectral characterisation studies. Aims. The high- and very-high-energy (HE, VHE) gamma-ray emission from PSR B1259-63/LS 2883 around the times of its periastron passage are characterised, in particular, at the time of the HE gamma-ray flares reported to have occurred in 2011, 2014, and 2017. Short-term and average emission characteristics of PSR B1259-63/LS 2883 are determined. Super-orbital variability is searched for in order to investigate possible cycle-to-cycle VHE flux changes due to different properties of the companion star's circumstellar disc and/or the conditions under which the HE gamma-ray flares develop. Methods. Spectra and light curves were derived from observations conducted with the H.E.S.S-II array in 2014 and 2017. Phase-folded light curves are compared with the results obtained in 2004, 2007, and 2011. Fermi-LAT observations from 2010/11, 2014, and 2017 are analysed. Results. A local double-peak profile with asymmetric peaks in the VHE light curve is measured, with a flux minimum at the time of periastron t(p) and two peaks coinciding with the times at which the neutron star crosses the companion's circumstellar disc (similar to t(p) 16 d). A high VHE gamma-ray flux is also observed at the times of the HE gamma-ray flares (similar to t(p) + 30 d) and at phases before the first disc crossing (similar to t(p) - 35 d). The spectral energy range now extends to below 200 GeV and up to similar to 45 TeV. Conclusions. PSR B1259-63/LS 2883 displays periodic flux variability at VHE gamma-rays without clear signatures of super-orbital modulation in the time span covered by the monitoring of the source with the H.E.S.S. telescopes. This flux variability is most probably caused by the changing environmental conditions, particularly at times close to periastron passage at which the neutron star is thought to cross the circumstellar disc of the companion star twice. In contrast, the photon index remains unchanged within uncertainties for about 200 d around periastron. At HE gamma-rays, PSR B1259-63/LS 2883 has now been detected also before and after periastron, close to the disc crossing times. Repetitive flares with distinct variability patterns are detected in this energy range. Such outbursts are not observed at VHEs, although a relatively high emission level is measured. The spectra obtained in both energy regimes displays a similar slope, although a common physical origin either in terms of a related particle population, emission mechanism, or emitter location is ruled out.