The word ‘where’ sometimes means if (i.e., wherever/whenever/when):
$$Q(x)\text{ is true where }P(x)\text{ is true}\tag1$$ might mean $$\textbf{if }P(x)\text{ is true, then }Q(x)\text{ is true}.$$ Example: “For each $x$ such that $P(x)$ is true, $Q(x)$ is also true.”
The word ‘where’ sometimes means and:
$$P(x)\text{ is true, where }Q(x)\text{ is true}\tag2$$ might mean $$P(x)\textbf{ and }Q(x)\text{ are both true}.$$ Example: “Let $P(x)$ be true such that $Q(x)$ is true.”
The tiny difference between between sentences $(1)$ and $(2)$ (the comma) is so technical that in practice, context is the only way to disambiguate their meanings.
The word ‘where’ sometimes literally means ‘for which’, meaning and:
Example: $\text“S$ is the set of reals where each, for some natural $k,$ equals $2k,\text”$ that is, $\text“S$ is the set of reals such that each, for some natural $k,$ equals $2k.\text”$
Since the word ‘where’, when used to introduce a clause in mathematical/technical writing, is potentially ambiguous, I'd use it sparingly and carefully; Paul Halmos agrees.
In this example, the author has, in one instance of the word ‘where’, unintentionally and confusingly invoked both the first two meanings!
is interchanging "where" and "such that" in a compound sentence always valid?
‘Where’ cannot be replaced with ‘such that’ in sentence $(1).$