I can, and have, thrown a 4 inch soft plastic worm with my 6 weight.
It isn't pretty, but it does cast. It can be effective in shallow water, but it is difficult to set the hook if you texas rig the worm. If you don't have too much cover and can get away with an open hook, it's easier.
I don't do that anymore, though. I prefer to fish with flies that I've tied, and I now have enough confidence in them that I can leave the worms in their bags.
Smaller 'trout' worms, crappie tails, little tubes, things like that aren't a problem to cast with a fly rod. Some of these are only an inch or inch and a half long. I just find them too small for bass fishing under most circumstances, and I have flies that work better anyway. Even a 4 inch worm is a 'small' bait for bass under most conditions, and a 6 inch worm is just too much to chuck with a fly rod unless you like to throw a 9 or 10 weight. Still not pretty, even with a heavy rod.
Buddy