Both of them are the culprits of stains thanks to their dark color and acid content. Tea has more tannins than coffee which lead to staining. Hot drinks can stain more due to the temperature change and the expanding and contracting of the teeth. This allows the stain to penetrate tiny lines and micro cracks in your enamel. Having your teeth cleaned regularly can help with this, or rinsing your mouth after each of these drinks.
Source: Grin –an oral health publication by Delta Dental.