This is actually a really great question and concern regarding sets. Actually, one of the recent things I found while studying and preparing to take my poker to the next level involved flopped sets and the strategy of playing them. It was hugely eye opening to me and had immediate impacts on how I play my game.
I tended to often looked at flopped sets as great hands but not great against flush draws, straight draws, made of either, or two pairs drawing possible boats, and higher sets. Which led me to read more about
pot odds, implied odds, etc. Which then led me to realize I was leaving a ton of value on the table folding sets a lot more than I should have been.
That said, I will now a days rarely, rarely fold a flopped set. And as others have said, I will strongly lean towards getting my money in on a flopped set when raised because odds wise even if the other person is drawing for a flush or straight, I'm getting good odds that I'll hit quads or full house, or they'll miss their draw. Sure a bigger set or quads could appear, I've had a set beat by higher sets or higher full houses to mine, but yeah I can't reasonably fold them anymore except in very specific instances.
I was blown away how much value they can have and how much that can pay off when you have people raising or going all in on draws or with their two pairs or TPTK. Of course if you're the one on a flush/straight draw you're pleased when the set holder doesn't hit quads or Full.