One good way to get worms for fishing bait is to go out during or just after a good rainstorm. Worms will be all over the sidewalks, gutters, etc. Just pick them up and put them into a used can or plastic container (such as an old tub from margarine or sour cream) filled with peat, potting soil, etc.
Worms that are healthy can live like this in a cool dark place (with the lid on) for weeks. A good place to keep them fresh and fairly dormant is the refrigerator, as long as it's not set so cold that they freeze.
Another option is to keep worms in a homemade worm bed. You can put extra worms you get during rainstorms into your bed for future use.
There are different kinds of worms. Nightcrawlers tend to come out at night and crawl around looking for mates. Red wigglers are popular for 'worm composting bins' and tend to like the dark and will remain in their box. Red wigglers are smaller, and are much better for trout or panfish. They also have the added benefit of producing excellent compost for your garden! All you need to do is add kitchen vegetable and fruit scraps, along with shredded dry leaves or paper. There are commercial bins you can buy, or you can build your own.