Have found this site which outlines the occasional references to religion in Star Trek.

What is interesting is that in a handful of episodes references are made to religion, or religious rituals (incuding on earth i.e. Mass at St.Peters Square, Hindu Festival of Light) that suggests religious practise still exists.
The overall general message from Star Trek is either anti-religious or an attack on primitive spirituality. It is interesting to consider that the joint Military/Scientific remit of Star Fleet perhaps encourages its members towards a more agnostic/atheist/secular view (with regards to just how many differing religions and alien races they encounter). Which by no means proposes that the human race (non-starfleet) has rejected religion, it’s just that it has little part to play in starfleet (perhaps?)

Religious references in Star Trek and its spin off series would seem to belong to two eras.
The Roddenberry era which is explicitly secular and which only properly engages with religion as an alien concept. This would cover TOS, the Movies and TNG.
The post-Roddenberry era which engages with religion in more of a style of toleration of many beliefs (just like your B5 reference). This would seem to account for the greater number of direct religious references found in DS9, VOY and ENT.

I would attempt to classify religious references in Star Trek using the following scale.
1 Explicitly Anti-Religious (Primitive Belief versus Scientism) Im not a God I’m just more technologically advanced than you are
2 Implicitly Anti-Religious (The Prime Directive and the Federation/Star Fleet superiority complex) It’s not our place to interfere with the spiritual/scientific/intellectual development of an alien race
3 Secular Tolerance (Prime Directive and the Spirit of Exploration and Comparative Species Studies)  Ben Sisko in DS9 when told by his son Jake that belief in gods is stupid: “My point is it’s a matter of interpretation. It may not be what you believe, but that doesn’t make it wrong. If you start to think that way, you’ll be acting just like Vedek Winn. Only from the other side. We can’t afford to be that way, Jake. We’d lose everything we’ve worked for here.
4 Positive Tolerance (The study of comparitive species and total open-mindedness, Existential experimentation) The possible interpretation that a spiritual experience is more than a biochemical process or spiritual roleplaying The Doctor as Physical and Spiritual physician (see Voy S6 E17 Spirit Folk)

Strangely, having not read the entirety of the Star Trek Religion page that I linked to I have discovered that the pages author also attempts to make some classifications, which roughly follow the path I have.

It would seem that there are 3 trends,

i) Gene Roddenberry secular/atheist the triumph of science over religion. Ignore religion and present Humanity as a united species.

ii) Brannon Braga secular/agnostic lets keep religion out of star trek and questioning whether science fiction should concern itself with religion in the same way other literary genres do. Perhaps dabble with religion in terms of spirituality, historical analysis and broad generalisations.

iii) DS9/Voyager trend, a tolerance of ‘true’ religion, not concerned with ‘truth’ claims but a comparitive study of spiritual experience.

I think TOS and TNG are explicitly exploratory series and are very pro-star fleet so the prime directive and scientific methodology take precedence. The Movies (which some consider an aberration) have a spiritual tendency but should be considered seperately from the rest of the canon as a movie allows more time to explore and use the symbols and metaphors of religion and spirituality than a tv episode would. DS9 and VOY are less exploratory series and the emphasis on star fleet is somewhat diminished. DS9 explores other cultures in the outpost/frontier context. And VOY is beyond the Federation and so is part of a broader cultural frontier/pioneer context.

I was suprised at how religious/spiritual the latter series have become. And I would disagree with the Braga trend that religion is a theme that the SF genre ought not explore. In fact I have the tendency to argue that the SF genre allows us to project ideas beyond the limitations of human language. In fact along that line rather than talk about religion as a facet in SF, is it possible we ought perhaps to be talking about SF as a method of theology/philosophy?