Why do you need to use the name?
Typically, you only need to do that with commands, e.g. see the GiveCommand and how it uses "targets".
For adding effects to entities see WitherSkeleton.doHurtTarget()
If you were going to do this outside of the context of commands, it would be something like this untested code:
public static void setGlowing(ServerLevel level, String name) {
var player = level.getServer().getPlayerList().getPlayerByName(name);
if (player != null) {
player.addEffect(new MobEffectInstance(MobEffects.GLOWING));
}
}