asalaam alaikum
This narration is reported in the chapter about the Al-Muawwadhtayn (surah falaq & surah Nas) in Hadith books. To fully understand the Hadith, I believe we have to first understand the 3rd verse of surah falaq.
FROM THE TAFSIR of the verse it's mentioned,
and from the evil of darkness when it gathers, that is, [from] night when it becomes dark and the moon when it is absent, (al-jalalayn)
More detail can be found in the tafsir of ibn Kathir,
(And from the evil of the Ghasiq when Waqab,) Mujahid said, "Ghasiq is the night, and 'when it Waqab' refers to the setting of the sun.'' Al-Bukhari mentioned this from him. Ibn Abi Najih also reported a similar narration from Mujahid. The same was said by Ibn Abbas, Muhammad bin Ka'b Al-Qurazi, Ad-Dahhak, Khusayf, Al-Hasan and Qatadah.
There is a different view as well and it's also mentioned by ibn Kathir,
Ibn Jarir said, "Others have said that it is the moon.''
The evidence for the people who reports this is the Hadith (others with similar wording) which you have mentioned. Ibn Kathir writes that a narration that Imam Ahmad recorded from Al-Harith bin Abi Salamah.
He said that 'A'ishah said, "The Messenger of Allah took me by my hand and showed me the moon when it rose, and he said, (Seek refuge with Allah from the evil of this Ghasiq when it becomes dark.)'' At-Tirmidhi and An-Nasa'i both recorded this Hadith in their Books of Tafsir in their Sunans.
Thus we understand that ghasiq when used in this Hadith means the moon. (Pls note that this Arabic word has various similar definitions). This is further strengthened by the supplication of gazing at the moon. ( Refer : Fathul Bari, Hadith: 4976)
EXPLAINING THE HADITH scholars have said,
the correct explanation of this Hadith is that since the moon rises in the night (in the daytime it does not shine even if it is there in the sky), what the Prophet (peace be upon him) meant was this: Seek God’s refuge from the night, the time when it (the moon) appears, for the light of the moon is not as helpful for the one who resists as for the one who attacks, and not as helpful for the victim of the crime as for the culprit. On this very basis the Prophet (peace be upon him) is reported to have said: When the sun has set, devils spread on every side. Therefore, gather your children together in the house and keep your animals tied down until the darkness of night disappears. (taken from my Islam)
Commenting on this Hadith Ibn Qutaybah said,
that the meaning of this is: seek refuge when it enters into the darkness and has an eclipse. And also he says that the moon in essense is not a source of light but rather it is dark, so this is what is intended by it being called “ghaasiq”, and its wuqoob is its wiping out its light at the end of the month.
ABOUT THE EVIL mentioned, it is to be understood in just the same way as evil is understood in the 3rd verse if surah falaq.
“And from the evil of the darkening (night) as it comes with its darkness; (or the moon as it sets or goes away).
May Allah the mighty and sublime grant us mercy and guide us to the straight path.
ALLAH KNOWS BEST