Can a character be simplified or traditional depending on the context it is used in?
To answer your question, we need to clearly understand how Traditional Chinese characters got simplified, which I bet 99.999999% of the whole Chinese population don't even know about.
This is a very big topic that I am not able to discuss about it in detail. So I will give a much simplified explanation.
Consider these 2 sets: Traditional Characters vs Simplified Characters
Of cause there is a mapping between the 2 sets. Most of the mapping (78%) is for &quot;non-simplification at all&quot;, like 人 口 手 大 小 天 地 etc. Those characters are NOT simplified.
While the rest of the mapping (22%) is the &quot;real simplification&quot;.
In the set of Simplified Characters, there are only 2235 &quot;real simplified characters&quot; in total.
Among the most used 3500 Chinese characters, there are only 1116 &quot;real simplified characters&quot;, so the percentage is 32%, less than 1/3.
A medium-sized Chinese dictionary roughly covers 10 thousand &quot;head charcters&quot;, among which there are 2235 &quot;real simplified characters&quot;, so the percentage is 22%, less than 1/4.
Now we can see the real simplified characters are only a small portion of the whole Chinese charaters.
All the following discussion is on the &quot;real simplification&quot; part of the mapping.

Most people believe the Simplification was done at the character level, meaning one traditional character will be replaced by its simplified counterpart in all circumstances, which of cause is wrong.
Actually the Simplification was done at the sense level, so it means a traditional character will be replaced by a simplified version only for a certain senses, but for other senses of the same traditional character, it is not simplified.

For example 乾 (gān, qián)
(gān) when meaning &quot;dry&quot; in 河乾了 or &quot;finish&quot; in 乾杯 (and a lot other meanings), it is simplified to 干, so they will become 河干了 or 干杯.
(qián) But when meaning &quot;sky&quot; or &quot;related to man&quot;, then it is NOT simplified. So even in an article in Simplified Chinese, you may see this phrase 乾坤 (meaning the sky and the earth). Another example is 乾隆, which is a name of an emperor in Qin dynasty.
Another example 瞭 (liǎo, liào)
(liǎo) when in 瞭解 meaning &quot;come to understand&quot;, it is simplified as 了, so it becomes 了解.
(liào) but when in 瞭望 meaning &quot;watch from a height or a distance&quot;, it is NOT simplified.

However there are quite some characters appear in both sets of Simplified Characters and Traditional Characters.

For example: 丑 (chǒu)
In the set of Traditional Characters, 丑 is used as the second of the twelve &quot;Terrestrial Branches&quot;, and also used as a surname. So its counterpart in the set of Simplified Characters is still 丑 (ie not simplified).
醜 (chǒu) is a Traditional Character, meaning &quot;ugly, hateful, disgraceful, scandalous, bad, dirty&quot; etc. It is simplified as 丑.

Simplification was done in the following 8 ways:

Get rid of the whole &quot;picture&quot; of the character, and &quot;redraw&quot; it with its &quot;main frame&quot;, like 龜  -&gt; 龟 (tortoise, turtle)

Regularify a character's the simple cursive style, like 為 -&gt; 为.

Use only a part of the character, like 聲 -&gt; 声.

Replace a part of a character by a lot less strokes, like 漢 -&gt; 汉.

Adopt a simple form from very old scripts (eg. oracle 甲骨文）, like 雲 -&gt; 云.

Use a simple character in the same pronunciation family to replace a part of the character, like 燈 -&gt; 灯 (replace 登 with 丁, as pronunciation of 丁 is very close to that of 燈).

Create new characters, like 響 -&gt; 响, 滅 -&gt; 灭 (响 and 灭 were created for the sake of simplification).

Use an existing simple character to replace a complicate character, like 幾 -&gt; 几.


The &quot;newly&quot; created simple characters are less than 100.

Well, it is a separate topic regarding traditional characters used in proper names (or signs, symbols), or some careless writers mix-use simplified and traditional characters in their articles.
So back to your question, using of simplified/traditional characters is NOT based on the context. Ideally if an article is written in simplified Chinese, then it should only use simplified characters, vice versa, unless for some special purposes (like an article written in simplified Chinese talking about simplification of traditional characters).