There are two matters buried in this question.
First, the word that the NIV rather carelessly translates as "anyone", is זוּר (zuwr) and means (BDB) "stranger". The matter at hand here is, Stranger to whom? The main two possibilities are:
- Stranger to the tabernacle, ie, a non-levite
- Stranger to Israel, ie, a foreigner
At least one of these possibilities can be immediately eliminated as we see from other references such as:
- Everyone who sinned had to bring a peace or sin offering to the entrance of the tent of meeting, Lev 4, which was inside the tabernacle courtyard. Such offerings were then sacrificed.
- Lev 19:21 has a similar law for guilt offerings
- Lev 17:8, 9 has a similar requirement for burnt offerings. In fact, if this is not done, such a person had to be cut of from Israel. Further, this law also applied to strangers (non-Israelites) equally.
Therefore, Num 3:38 cannot be taking about either non-Israelites of non-Levites. In fact, the text is taking about where people made their camp. There were very strict rules about where people from any given tribe, etc, could pitch their tent in relationship to the Tabernacle.
Num 3:38 is one such law - no one but those from the family of priests (Moses and Aaron) could camp directly to the east of the Tabernacle. Num 3:38 says that if anyone tried to do this, they would be put to death. These specially designated priests had charge of all the Tabernacle equipment, etc, and need ready access to the Tabernacle, especially when packing it up to move camp or when they stopped and pitched the Tabernacle in t new location.
The Pulpit commentary note this:
Verse 38. - Before the tabernacle toward the east,... Moses, and Aaron
and his sons. The most central and honourable place in the camp, and
the most convenient for constant and direct access to the sanctuary.
Moses held a wholly personal and exceptional position as king in
Jeshurun (Deuteronomy 33:5); Aaron was hereditary high priest. Between
them they represented the union of royal and sacerdotal authority,
which had many partial continuations in Jewish history, but was fully
realized in Christ.