But when riding the bike, and testing the rear brake by using it isolated, it doesn't brake good. Could the shoes be worn out?
possibly, but you'll want to pull the drum apart and check.
if you've got good meat on your pads, you can put some emery paper to the ID of the drum to deglaze it a bit, and dry rag wipe all the brake dust (dust mask suggested - asbestos maybe) and clean it up. Blow out(outside) with air if you have it.
Re-assemble, and give the brake lever adjuster spring nob a turn in, or three, from its last position to allow the pads to engage earlier in the brake lever travel.