The longer I go the more spoilers will appear as I recall more things.
So the story starts with the protagonist being a young boy living in a smallish community of houses floating on the sea (ocean?). His older brother was pretty religious, but our protag isn't. Turns out the brother became so religious after nearly drowning, which was done on purpose with weights attached. This is pretty taboo and frowned upon, but among those who do it, many do become religious and one with god etc. The community uses sentient-y/living-y boats (sufficiently advanced technology). I think the church they have their sermons at was made out of hundreds of those boats they use. Also at one point during his childhood, our protag gets split from his brother and nearly gets lost after he escapes someone by diving into the water.
I think the longer the story goes on, the more we find out that everyone on the planet is descended from an interstellar arkship, but they kinda forgot about it. The most saintly person in the church is the captain of that arkship? Also pretty sure she could edit genes using some technology that was on that starship and so all the people on the planet are descendants of edited people.
The protag gets older and visits a nearby island (could be continent, the point is that it's not the floating sea community anymore), I think for a wedding (his brother's and his also Drowned girlfriend?). There he meets a girl and we learn that when people on this planet have sex, they swap genitals, which causes problems after the girl the protag meets turns out to not be as religious as him after they already have had sex. Anyway, they swap back (so no one finds out that he had pre-marital sex).
Now there's some gaps in my memory, so I'll only say the plot points that I think were actually in the story :P So some years pass and our protag becomes a (micro)biologist, living on land. Has to work on some bacterium no one cares about, which he doesn't like that much. Later on, he or some other researcher finds out that there are bacteria living in the sea that make people feel super good and they somehow activate when people nearly drown. So that shatters his religious beliefs and he either loses them forever or regains a semblance right at the end of the story.
Also at some point the protag's mother is on her death bed. The brother never wavered from his faith and this causes some disagreement with the brother. (The brother either doesn't care about his heathen mum, or he's unfazed because she'll just move on to the afterlife. Either way, the point is that they disagree before she does finally die)
A scene that maybe happens that I am much less sure about:
I think after this discovery our protag visits a lake full of the stuff. A local man(men? a couple?) lives there and is the keeper of the lake and guides people into something like a baptism. For some reason our protag goes into the lake, which the guardian is wary about, because he thinks the lake will hurt/kill our protag, because the concentration is too potent. Our protag has high tolerance because of his childhood experiences, and survives.