If I were you I would want to approach this question by thinking about the two central analogies that are drawn in both of these excellent poems and how they operate. This seems to me to be the obvious point of comparison between these two texts.
In "A Noiseless Patient Spider," the spider that the speaker sees flinging forth its filaments and making connections is compared to the soul of the speaker, that likewise seems to be like the spider as it is surrounded "in measureless oceans of space" and is trying to connect the "spheres" with its thread:
And you O my soul where you stand,
Surrounded, detached, in measureless oceans of space,
Ceaselessly musing, venturing, throwing, seeking the spheres to connect them,
Till the bridge you will need be formed, till the ductile anchor hold,
Till the gossamer thread you fling catch somewhere, O my soul.
The spider and the soul both are trying to build connections and bridges, and this is the point of comparison that allows Whitman to explore how the soul seems to be flinging out threads to try and connect to someone and to somewhere, desperate to find its identity in the world in which it is "detached."
Likewise, in "Dover Beach," the "grating roar" of the pebbles as the waves of the sea draw them back and them cast them once again on the shore is compared to "The Sea of Faith," which, according to the speaker, is withdrawing, just as the tide is withdrawing, leaving the world an exposed and vulnerable place:
The Sea of Faith
Was once, too, at the full, and round earth's shore
Lay like the folds of a bright girdle furled.
But now I only hear
Its melancholy, long, withdrawing roar,
Retreating, to the breath
Of the night wind, down the vast edges drear
And naked shingles of the world.
Note the emphasis on the "naked shingles of the world." The sea becomes a powerful metaphor for the beliefs that the speaker fears are vanishing from the world. Something powerful is gradually leaving the world, leaving it "naked," and therefore open to pain, attack, and vulnerable. This poem paints a bleak picture of the state of the world thanks to the decline in religious faith.
So both poems contain unforgettable analogies, as the spider throwing out its filaments is compared to the soul in one, and the tide withdrawing is compared to the decline in religious faith in the other.