Religion plays a major role in Jude's life when he is young. While his first dreams are of going to Christminster to be a classical scholar, he eventually thinks of going there to pursue religious goals. He even decides to become a Bishop someday. Religion continues to dominate Jude's world as he gets older, but in a very different way. The religious morals of the time make his and Sue's relationship a sinful one. In the end, Jude swears off religion (or at least begins to heavily doubt his former beliefs). However, Sue, who has always disparaged religion, turns to the Church after her children are killed.
Sue's turn towards religion at the end of the novel is meant to be a tragedy rather than a positive experience of conversion.
While religion plays a part in Sue and Jude's downfall, Hardy's criticism of the Church is less about faith itself and more about the socially repressive and judgmental consequences of Church hierarchy in British culture.