All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The two verses are identical and they have the same meaning.
The first verse does not indicate that the night comes before the day, but it indicates that both the night and day follow each other and comes after it, without delay, seeking it rapidly.
It is for this reason that the interpreters of the Quran considered the verse in Surah al-A’raaf [Quran 7:54], to mean the same thing as a the verse in Surah Yaseen [Quran 36:40]; that each of the day and night follow one another without delay.
Ibn Katheer said: “He brings the night as a cover over the day, seeking it rapidly”, meaning, the darkness goes away with the light, and the light goes away with the darkness. Each of them seeks the other rapidly, and does not come late, for when this vanishes, the other comes, and vice versa. Allah also said: {And a sign for them is the night. We remove from it [the light of] day, so they are [left] in darkness. And the sun runs [on course] toward its stopping point. That is the determination of the Exalted in Might, the Knowing. And the moon - We have determined for it phases, until it returns [appearing] like the old date stalk. It is not allowable for the sun to reach the moon, nor does the night overtake the day, but each, in an orbit, is swimming.} [Quran 54:37-40] {Nor does the night overtake the day} means, the night follows the day in succession and does not come later or earlier than it should be. This is why Allah said here, {seeking it rapidly}.” [End of quote]
Therefore, this is very clear in illustrating what we have mentioned above.
Allah knows best.