After much googling, the closest thing I found to what I need is
But that only checks if the player has EXACTLY 10 levels, rather than AT LEAST 10 levels, like I want. The "..2" for distance means "two or less," but that syntax doesn't seem to work within NBT tags.
Code:
execute if entity @p[nbt={XpLevel:10},distance=..2] run <command>