Can a PC cast any kind of spells outside of combat? Wouldn't that render items such as torches useless if for example a cleric or a bard was in the group?
Yes, player characters can cast their spells at any time unless something explicitly prevents them from doing so.
Players can cast spells any time they want as long as it's their turn, they have a spell slot available (if the spell needs one; most non-cantrip spells do), and they can provide the verbal, somatic, and/or material requirements.
This does, in fact, render torches relatively useless (as a light source) for any group that includes a character capable of casting Light (or where all characters have darkvision). There's nothing wrong with that; many groups don't like keeping track of how many torches they have, deciding when they run out, figuring out who's going to forgo a shield to carry one, etc. Torches are described in the manual because some groups will need them, not because all groups will need them.
On the other hand, as mentioned by several commenters, even in a party with a caster who knows Light torches have potential utility as a backup light source (in case your caster is elsewhere, unconscious, or otherwise unavailable) as well as in a wide variety of scenarios in which you might want to set fire to trolls, books, witches, orphanages, animated corpses, effigies of the local ruler, inanimate corpses, or any other object or entity that is both objectionable & flammable. Being creative people, adventurers may find even further uses for torches that don't involve their being a source of light & heat, so really the only reason not to bring a few torches is severe weight & space constraints (which is no reason at all if your group doesn't bother tracking those sorts of logistic concerns).