My answer is based on my own analysis of the context of the verses you are mentioning.
Usually, a parsha "break" is used to separate ideas or stories. Keep in mind, that for the most part, the verses you are mentioning list names of places. However, as verse 2 of the same chapter implies, these travels were also indicated because special events happened, and most commentaries also explain that many of the names themselves are not necessarily place names but allusions to events that happened.
Verses 38 and 39 seem to interrupt the pattern of listing places and it mentions Aharon's death. Why isn't the parsha break before verse 38? Because verse 37 says that they arrived at Hor Hahar, and since Aharon died at Hor Hahar, it is connected to that place.
Verse 40 talks about the King of Arad attacking, which is not related to Aharon's death, per se, but is an event that occurred during the travels, so it belongs in a separate parsha.
Another answer, that I think has stronger support:
Compare the end of Bamidbar ch. 20, which talks about Aharon's death, and the very beginning of Bamidbar ch. 21, which talks about the King of Arad attacking B'nai Israel. You will notice two similarities:
- A parsha break which is stumah (closed)
- Bamidbar 21:1 and verse Bamidbar 33:40 begin with the same words.
Perhaps, to maintain similarity and "consistency", the same location and type of parsha break is here as it was there!