These are guidelines for the length of the Levites' service.
Whereas 4:3 says their service in the Tent of Meeting started at age 30, 8:24 says age 25. This difference might show changes in age requirements over time, depending on how many Levite men were available. Those aged 25–29 might have been unofficial workers or apprentices.
Both passages set the retirement age at 50. Retired Levites could serve as guards of the Tent of Meeting (see Psalm 84:10).