I'll give an example to help:
Someone suffered a car accident, but physically the person is OK. So I say, "Thank God, he/she is fine."
If you want to express thanks to a "higher power" but want to name it something other than God, (or God-related, like "thank heavens" "praise the lord", "lord have mercy" "hallelujah" etc.) you could say "thank goodness". "Goodness" can mean more than just lucky happenstance in that situation.
If you want to just say that it is fortunate she was not injured, due to nothing more than the particulars of the accident, you could say "thank her lucky stars" or "thankfully, she was not hurt".
I interpret many insurance accident claims phone calls, and I've noticed that most insurance company accident claims processors will avoid faith-based terms by expressing their own relief to know that no one was injured with statements like, "I'm glad to hear no one was hurt," "I'm sorry for your experience, but it's so fortunate that there were no injuries," "what a relief to know everyone is okay."
I agree with many that "thank God" is used ubiquitously, regardless of faith, religion, or spirituality.
I am pleased or happy
The Free Dictionary
Depending on the people and setting, this is a favourite vulgar expression of mine...
Thank fuck for that!
Maybe just a British thing?
Replacing "thank god" with thankfully should work in all cases. Otherwise:
It's a relief that... / I'm glad that...
You may use the expression:
What a relief to know that you were out of danger!
This gives the following sentence:
Fortunately, he/she is fine!
Many responses say something like "thank the goddess" or "thank goodness" or "thank science". But unless you believe one of these things is a person to whom you owe gratitude, that's nonsense at best and may be taken as mocking those of us who do believe in a higher power. (Which you're free to do, but it wasn't what you asked about.)
Why not say something that expresses happiness rather than thanks?
You could thank whoever or whatever is actually responsible:
"Hank was struck by lightning, but thanks to the doctors who worked on him, he's going to be okay.
"Lucy was attacked by a velociraptor, but thanks to the quick response of the park rangers, she only suffered minor cuts and scrapes."
"Ben was hit by a bus, but thanks to the fortunate angle at which the bus hit him, he's going to be okay."
You could say "thank the laws of physics". (I've never heard anyone actually use this, and may only be funny to World of Warcraft players).
It's an obvious mockery / subversion of the common religious / spiritual phrase, and only works as a joke. (Because science doesn't involve worshipping our current best understanding of how things work). Even as a joke, it also draws attention to the fact that you're avoiding religious language in a really on-the-nose way.
For the love of science is less over-the-top (you can love science), and I have actually said it out loud in real life. It doesn't exactly fits this use-case, though.
Why is it necessary to say anything at all? It would be like talking to the dice before you throw them. 'How about I'm glad you are alright!'
Fritz Lieber, the science fiction author, coined "thank the bonny dew" to which I'm partial.
There are also sub-culturally specific answers, thanking whatever omnipotent entity or idea is prominent in their defining literature.
For instance, wiccans would be likely to say "thank the goddess"; avid anime fans might say "thank kami"; a big lovecraft fan could say "thank azathoth"; a mythology lover might say "thank baal"; science fans could say "thank physics"; I even heard someone say "thank frog" once.
In other words, you can use absolutely any expression you want, and as long as it doesn't have a clear other meaning (e.g. "thank obama" might not be taken so well), people will understand it from context.
"Thank Goodness". It is intentionally meant to look/sound similar to "Thank God" (ie "God" vs "Goodness"), but as to explicitly not mention "God". This is an example of "minced oath"
A minced oath is a euphemistic expression formed by misspelling, mispronouncing, or replacing a part of a profane, blasphemous, or taboo term to reduce the original term's objectionable characteristics. Some examples include gosh, darn, dang, fudge and heck.
I've always been partial to "Blessed be!", although that's been construed as religious too.
This are few that I like to use.
Oh my Goodness
Yes We/you did it
Glad to hear that he is OK