May peace be with you.
In my humble opinion, neither of the numbers that you have shared are correct from a Quranic perspective.
For example, 18 prophets have been
explicitly mentioned in verses 6:83-89 separately from Prophet Muhammad (33:40). Furthermore, Idris is also mentioned as a prophet in verse 19:56. This makes a total of 20 prophets. These prophets are also by default, messengers (unlike the traditional view which reverses this understanding without warrant from the Quran).
[1] If you also add the 3 named messengers (Hud, Shoaib and Saleh) who are not identified as prophets by the Quran, you have a total of 23 messengers.
Adam, Dhul-Kifl and Luqman are also mentioned but neither as prophets nor messengers.
I hope that helps, God willing.
Joseph.
REFERENCE:[1] END OF PROPHETHOOD - CONTINUATION OF MESSENGERS?http://quransmessage.com/articles/end%20of%20prophethood%20FM3.htm