As a quick aside/introduction, this answer might be better served as an answer to "what is meant be 'intensional context' in the philosophy of language?" because I go over more than just the titular question about substitutivity. However, due to a comment you made about the question of modality and the number of planets, it seems to me that a larger explanation of this topic is what you're really looking for or at the very least it will help clear up your confusion on the topic.
Intensional Transitive Verbs
Intensional contexts are brought about when you have what is called an "intensional transitive verb" acting in a proposition. A transitive verb is a verb that transfers action from one object to another, for example "carry" transfers the action from the subject, that which is carrying, to the object, that which is being carried. A intransitive verb is the opposite, a verb that does not transfer action. An example would be "sleep", as in "I sleep," where it is clear that there is no object that is being transferred the action of "sleeping".
The three criteria that make a transitive verb intensional are outlined in the Stanford Encyclopedia of Philosophy's (SEP) article "Intensional Transitive Verbs" (in the quote, "VP" means verb phrase), and in order for an intensional context to arise it is sufficient for at least one of these criteria to be met:
(i) substituting one expression for another that is coreferential with it in the complement of the verb can change the truth-value of the sentence in which the VP occurs;
(ii) the VP admits of a special “unspecific” reading if it contains a quantifier, or a certain type of quantifier;
(iii) the normal existential commitments of names and existential quantifiers in the complement are suspended even when the embedding sentence is negation-free.
(i) can be summarized as saying that a transitive verb is intensional if substitution of a coreferential phrase in the verb phrase has the ability to change the truth value of the proposition. Notice the phrases "can change" and "has the ability to change"; it is not necessary that the truth value does change, only that it can. (ii) can be summarized as saying that a transitive verb is intensional if it allows for what is called the de dicto / de re distinction (it is also referred to as the "relational/notional ambiguity"). (iii) can be summarized as saying that the object of the verb phrase does not need to exist for the proposition to be true.
Criterion (i): Referential Opacity
The example the article uses for criterion (i) is between Lois Lane and Clark Kent/Superman. It is clear to everyone who reads the comics that Clark Kent and Superman are the same person. However, Lois Lane, Clark Kent's love interest, does not know that they are the same person. We then can analyze these four propositions, keeping in mind our knowledge of what Lois Lane believes:
(1a) "Clark Kent can fly."
(1b) "Superman can fly."
(2a) "Lois Lane believes Clark Kent can fly."
(2b) "Lois Lane believes Superman can fly."
What we can see is that (1a) and (1b) are both true, and they are true in an extensional context. We know that the person to which both "Clark Kent" and "Superman" refers can fly. However, when we talk about the belief of someone, then we transfer into an intensional context. Even though (1a) is true, (2a) is false because we know that Lois Lane does not believe that there is anything special about Clark Kent; she views him as mild-mannered and docile with no super-human capabilities. (2b), however, is true and we know this because Lois Lane has seen Superman fly, she's even been carried by him while he is flying. In (1a) and (1b) we have an example of a substitution of a coreferential term, and the substitution preserves the truth value. This means that, according to our criterion (i), (1a) and (1b) are not intensional transitive verbal phrases. In the case of (2a) and (2b), substitution does not preserve truth value, because we are dealing with Lois Lane's belief, and therefore we can ascribe, via criterion (i), to "belief" the property of being an intensional transitive verb. It is common terminology to refer to these types of sentences as being "referentially opaque environments".
Other, historically important (this entire topic can be seen as stemming from Frege's Puzzle and the subsequent development of the philosophy of language and analytic Philosophy), examples of objects that could fit in this example are Hesperus and Phosphorus, as well as Cicero and Tully. People can believe something about Cicero while believing the complete opposite about Tully, even though they are one in the same. Historically, people did believe as much about Venus.
We have established that "believes" is an intensional transitive verb based off of it falling under criterion (i). Other verbs or verb phrases that fall under criterion (i) include: "thinks", "is aware", "feels as though", etc. It is important to note that these, as well as the future examples of verbs that fit the other criteria, are mostly examples of propositional attitude verbs. The SEP article "Propositional Attitude Reports" defines these as such:
Propositional attitude reports concern the cognitive relations people bear to propositions. We typically make such reports by uttering propositional attitude reporting sentences like ‘Jill believes that Jack broke his crown’, employing a propositional attitude verb like ‘believes, ‘hopes’, and ‘knows’, followed by a clause that includes a full sentence expressing a proposition (a that-clause).
Criterion (ii): Permitting of the De Dicto/De Re distinction
An example for criterion (ii) requires first a definition of the de dicto / de re distinction. These two terms respectively mean "of what is said" and "of the thing".
Historically, this distinction's first major discussion came from Quine's 1956 paper "Quantifiers and Propositional Attitudes". The paper is essential reading if you want to understand more about these topics but it requires an understanding of predicate logic first. What Quine pointed out is that there is an ambiguity that arises in certain propositional attitude reports. Consider this proposition:
(3) Alice wishes for a cat.
This proposition is ambiguous in the sense that it permits two different readings:
(3a) Alice wishes for a cat, any which one will do.
(3b) There is some cat that exists, and Alice wishes for that cat to be hers.
(3a) is said to be a de dicto reading, while (3b) is said to be de re. The main ambiguity of (3) is that "a cat" can have two meanings: it can mean some thing in particular which also is a cat or it can mean any old cat. (3a) is described as de dicto to show that what Alice wishes is about the sentence itself, or "what is said": she just wishes to have a cat. (3b) is described as de re because Alice is talking about a particular thing of which the phrase "a cat" refers.
Another important example of the distinction that builds off of this example is:
(4) Alice wishes for the smartest cat of the litter.
This sentence gives two readings:
(4a) Alice wishes for the smartest cat of the litter, whichever individual cat that happens to be.
(4b) Alice wishes for Benny, who just so happens to be the smartest cat of the litter.
In this example, Alice's wishes can be split up very easily into de dicto and de re. In (4a) she is wishing for whichever cat fits the description of "the smartest in the litter", which is of course de dicto. She would presumably like to have some sort of feline intelligence test conducted before deciding which cat to have for her own. In (4b) we have Alice wishing that she could own Benny, and Benny just so happens to be the smartest cat of the litter, which is of course de re. In this case "the smartest cat in the litter" is a coreferential phrase with "Benny", and that is the total extent to which Alice uses it (meaning, she doesn't use it as the criterion for which cat she wishes for, merely as a referential phrase).
Quine uses the now famous example sentence of:
(5) Ralph believes there is a spy.
which gives us the two readings of
(5a) There is someone in particular who Ralph believes is a spy.
(5b) Ralph believes that there is someone who exists that is a spy, whomever that may be.
Notice that in this example I have switched the order, (5a) is now the de re example and (5b) is the de dicto This was done to match Quine's examples that I will now quote (I've changed the numbers to fit with my example):
Both may perhaps be ambiguously phrased as 'Ralph believes that someone is a spy,' but they may be unambiguously phrased respectively as 'There is someone whom Ralph believes to be a spy' and 'Ralph believes there are spies.' The difference is vast; indeed, if Ralph is like most of us, [(5b)] is true and [(5a)] false.
That is to say, in (5b) Ralph believes that espionage is a real thing and there are some people out there who participate in it, while in (5a) he means to say that there is a person whom Ralph for one reason or another believes is actually engaged in espionage.
Finally, you brought up the topic of modal statements in your comments. Kripke uses the number of planets as an example for this distinction in his paper "Speakers Reference and Semantic Reference" (It is relevant to point out that it was originally published in 1977):
“The number of planets is necessarily odd” can mean two things, depending on whether it is interpreted de dicto or de re. If it is interpreted de dicto, it asserts that the proposition that the number of planets is odd is a necessary truth— something I take to be false (there might have been eight planets). If it is interpreted de re, it asserts that the actual number of planets (nine) has the property of necessary oddness (essentialists like me take this to be true).
The irony of this example shouldn't be lost on anyone who is aware that Pluto is no longer considered a planet and therefore the number of planets is eight, which is necessarily an even number.
Similarly to before, words such as "believes" and "thinks" can lead to an intensional context via criterion (ii), but we also have verbs such as "desires" and "wants" among many, many others. Important to note, of course, is that the modal operator "necessarily" also admits this distinction.
As a historical aside, Quine's main argument in the paper linked above is that quantifying into modal contexts is nonsensical and cannot be done logically. That paper spawned a massive debate in the philosophy of language about that topic which is best summarized in the beginning of Kripke's paper "Unrestricted Exportation and Some Morals for the Philosophy of Language".
Criterion (iii): Non-existential commitment of verb compliment
Luckily, our criterion (iii) is the easiest of all. There are certain transitive verbs that are intensional because there is no "existential commitment" of the object of the verb, meaning we don't require that object to actually exist.
Consider these two sentences:
(6a) I desire a unicorn.
(6b) I have a unicorn.
(6a) is intensional because the truth of that statement does not rely on whether or not the object of the verb, the unicorn, actually exists (also notice that it falls under criterion (ii) but that is not important now). (6b) is not intensional because in order for that proposition to be true, the unicorn in question must actually exist. (6a) could be true or false, depending on how I feel towards unicorns, but either way it is not dependent on whether or not unicorns actually exist. In this way, (6a) is intensional and (6b) is not.
Other verbs that fit our criterion (iii) include: "seek" (the SEP article gives the example of a fountain of eternal youth, consider "Ponce de León seeks the fountain of eternal youth" is true whether or not the fountain exists) and "paint" (I can paint a unicorn whether or not one exists), among others. Most of the verbs covered before also apply: "I believe in ghosts" may be true whether or not ghosts exist.