The goal of this study is to check which, if any, of the published versions of the pion and kaon fragmentation functions (FFs) is compatible with the STAR data on semi-inclusive pion and kaon production in proton–proton collisions, and on the basis of this analysis to make reliable predictions for the p T spectra of the pions and kaons in inclusive pion and kaon production at the future NICA proton–proton collider. The calculations are carried out in next-to-leading order (NLO) of perturbative quantum chromodynamics (pQCD), using the well-tested CTEQ6 parton distributions. We consider the following pion and kaon FFs — DSEHS-14 [D. de Florian, R. Sassot, M. Epele, R. J. Hernández-Pinto and M. Stratmann, Phys. Rev. D 91, 014035 (2015), 1410.6027], DSEHS-17 [D. de Florian, M. Epele, R. J. Hernandez-Pinto, R. Sassot and M. Stratmann, Phys. Rev. D 95, 094019 (2017), 1702.06353], LSS-15 [E. Leader, A. V. Sidorov and D. B. Stamenov, Phys. Rev. D 93, 074026 (2016), 1506.06381], HKNS-07 [M. Hirai, S. Kumano, T. H. Nagai and K. Sudoh, Phys. Rev. D 75, 094009 (2007), hep-ph/0702250] and AKK-08 [S. Albino, B. A. Kniehl and G. Kramer, Nucl. Phys. B 803, 42 (2008), 0803.2768]. Our analysis shows that within the experimental errors all tested sets of FFs provide a good fit to STAR data at the c.m. energy S = 2 0 0 GeV , and the best ones are both LSS-15 and DSEHS-14 for pions and DSEHS-17 for kaons. From comparison of the LO and NLO results it is clear that the latter fit data much better, specially in the region of small p T . The NLO cross-sections are also less scale- Q 2 dependent, where p T / 2 ≤ Q ≤ 2 p T , than the LO ones. In order to make predictions for NICA energies, we compare the NLO pQCD results with the existing experimental BES STAR data on semi-inclusive hadron production in the most peripheral Au+Au collisions where the nuclear effects can be neglected. The comparison for lower energy scales, like at NICA, shows that a purely pQCD approach is inadequate and suggests the necessity to take into account also higher-order effects of initial-state soft-gluon radiation. Nevertheless, these data on the p T spectra of π + , K + and also the ratios π − / π + and K − / K + seem to favor LSS-15 and DSEHS-14 FFs for pions and DSEHS-17 for kaons, similarly as at the energy scale S = 2 0 0 GeV. [ABSTRACT FROM AUTHOR]