Perfect substitute- Pepsi and Coca-Cola and Imperfect substitute- Tea and Coffee . Here why tea and coffee considered imperfect substitute?
Any two specific goods can be perfect substitutes, imperfect substitutes or even complements depending on the preferences. It's not goods themselves, but our preferences towards them what make them substitutes or complements.
However, when many people have similar preferences towards those goods, it is common to characterize goods as being, for instance imperfect substitutes. Apparently, you have no qualms about Pepsi and Coca-Cola being imperfect substitutes, and I guess that's because it agrees with your own preferences towards them. Tea and Coffee are imperfect substitutes for many people, who may drink sometimes one and sometimes the other. Of course, they're not substitutes at all for people who only drink Tea or only drink Coffee. The fact that we colloquially say that they are imperfect substitutes should be understood as most people thinking of them as such.