It could be either, but it might edge slightly towards "formal". This expression is usually used by polite and well-educated people. This is backed up by some websites.
According to Grammarhow - professional ways to say "I'm glad to hear that":
“I'm glad to hear that” is not informal. It can work in both professional and non-professional circumstances.
According to grammarhow - good to hear vs glad to hear
Glad to hear should be used when speaking on a more personal note, as “glad” is a feeling that we can have towards someone.
Noting this, we can deduce that it is better to use "good to hear", especially on the formal side.
More information will be added soon