You could argue that both stories present the idea that all human beings are inherently sinful and that we all make choices to avoid acknowledging that sinfulness for what it is; this unwillingness ultimately damages our relationships with each other and with God.
As Young Goodman Brown walks into the forest, he thinks to himself, "'[Faith] is a blessed angel on earth; and after this one night, I'll cling to her skirts and follow her to Heaven.'" But this is not the way Faith works. One cannot simply put one's faith down and pick it back up again when it suits. We cannot voluntarily and cheerfully commit sin simply because we believe that faith and piety will be available to us later. This is not being honest, and it's like trying to trick God. In the story, Brown's strategy doesn't work. He is never able to regain his faith in the end.
Similarly, Mr. Hooper's congregation understands, on some level, that his veil represents "secret sin," as this is the subject of his first sermon after he begins to wear the veil; each of us has a secret sinful nature that we try to conceal from ourselves, each other, and even God. However, the parishioners seem to quail before even asking him, explicitly, about the veil's meaning, because they do not want to hear the answer. Even Mr. Hooper's fiancee, Elizabeth, comes to understand it, and—when she does—she leaves him forever. No one in the town is willing to be honest, except for Mr. Hooper, and he is alienated for the remainder of his life as a result. In the end, their strategy of denial and ostracism fails, and he calls them all out, saying,
"When the friend shows his inmost heart to his friend; the lover to his best beloved; when man does not vainly shrink from the eye of his Creator, loathsomely treasuring up the secret of his sin; then deem me a monster, for the symbol beneath which I have lived, and die! I look around me, and, lo! on every visage a Black Veil!"
They are all sinful, and yet they all attempt to hide their sin. Essentially, they lie, and this adds sin on top of sin, compounding their souls' wrongs.
In both stories, characters understand their inherent sinfulness, but choose to ignore their own role, their own agency, in choosing sin. It is one thing for sinfulness to be part of human nature, but it is quite another to recognize one's sinfulness and do nothing to change it.