It would seem that the number 42 has a deeper Divine underpinning which makes it foundational to the Jewish people.
Similar to what has already been pointed out about the 42 stops of the Bnei Yisrael, it is worth noting the Magen Avraham 428:8 who writes:
כתוב בצרור המור מ"ב מסעות שבפרשת ואלה מסעי אין להפסיק בהם שהוא נגד שם מ"ב
The Tzror Hamor writes that the 42 journeys that are enumerated in Massei, we don't make a break (in their recitation) as they correspond to the 42 letter name of G-d.
The Tzror Hamor explanation on Massei here is deeply Kabbalistic and I don't understand it all. He starts by saying:
ולהורות שיש באלו המסעות דבר גדול. אמרו רבותינו ז"ל שנכתבו כאן שנים וארבעים מסעות. רמז לשם המפורש של שנים וארבעים
To teach that in these journeys there is a great thing. Our Rabbis of blessed memory write here that there were 42 journeys. This is a hint to the (42-letter) name of G-d which correlate with the 42 (journeys).
He then goes on to point out how this 42 can be seen to have its link with the creation of the world, how there are 7 words each with 6 letters which equate (7 x 6) to 42.
And thus:
וכמו שהתורה התחילה בימי בראשית שבם רמוז שם ה' ב"ם. כן סיימה בפרשת אלה מסעי בספור שנים וארבעים מסעות שהם כנגד שם של שנים וארבעים שהזכרנו. לרמוז שהתורה כולה כלולה וקשורה וחתומה בחותם אחד. בסוד ה' אחד ובסוד ה' בם. ואין בה פירוד וחילוק אלא שהיא קשורה תחלתה בסופה וסופה בתחלתה. ולכן כתב באלו המסעות ויכתוב משה את מוצאיהם למסעיהם ע"פ השם
And like the Torah begins with the days of creation that alludes to the 42-letter (ב"ם) name of Hashem, so too it concludes in Parshas Massei with counting 42 journeys corresponding to the 42-letter name like we mentioned. To hint that the whole Torah is included and bound and signed in one seal. In the secret of the one G-d, and in the secret of Hashem (ב"ם) in it / 42. And there is no separation and division in it but it is connected with its beginning at the end and its end with its beginning. Therefore it writes about these journeys, "And Moshe recorded the starting points of their journeys" through Hashem i.e. through His 42-letter name.
So the number 42 has its roots in the Divine and that is why halachically we don't make any breaks when reading about the 42 journeys and could possibly be why the number 42 pops up in various places throughout Tanach as it involves some form of Divine intervention.
EDIT
When viewing this in light of the other instances where 42 is mentioned in Tanach it is clear to see similarly, some form of Divine input.
We know as has already been mentioned in some other answers, that Balak offered up 42 sacrifices (14 offerings x 3 different locations = 42). Whilst famously, the Gemara in Sanhedrin 105b notes that as a result he merited that Rus / Ruth descended from him. There is also a noteworthy Gemara in Sotah 47a which writes as follows:
אמר רבי חנינא בשביל ארבעים ושנים קרבנות שהקריב בלק מלך מואב הובקעו מישראל ארבעים ושנים ילדים
Rabbi Chanina said: due to the 42 offerings that Balak, king of Moav brought, 42 children were broken off from Israel.
So the 42 offerings that Balak brought, impacted on another 42, this time the 42 boys that were killed by the bears (that you also reference in your question).
So the question is, what was this connection, and how does the number 42 have any bearings (excuse the pun!).
Interestingly when doing some searching on Sefaria, I stumbled on the Zohar which also links these two incidents but sheds some more light. In the Zohar 2:224a it writes that Rabbi Shimon comments that these 42 sacrifices directed a "סִטְרָא אַחֲרָא לְגַבֵּי קוּדְשָׁא בְּרִיךְ הוּא" - lit. "an other side towards Hashem" (the סִטְרָא אַחֲרָא is normally understood Kabbalistically as the side of impurity or in layman term the 'realm of evil' etc.) and this "other side" was called "curse". I believe what the Zohar goes on to say, is that the actions of Balak, whilst weren't of righteous nature created some sort of Divine 'debt' that had to be repaid which came in the form of these 42 children that were killed.
Indeed the Ben Yehoyada on the Gemara in Sotah concludes that this 'curse' is hinted to in the incident of the bears. He writes that the verse in II Kings 2:24 the word for "bears" - "דֻּבִּים֙" is missing the "ו" which hints to "יד ב"ם" - "the hand of Bam" (i.e. the 42 letter name).
So once again we see in another two instances that the number 42 connects in some way to the revered 42-letter name of Hashem and has a far-reaching Divine impact.