As far as I know, both of these have a similar meaning. Are both interchangeable? In what situations would 変 be preferable over おかしい?
They are not as interchangeable as you might expect. I recommend sticking to 変 when you are going to express general "weirdness". 変 is somewhat broader to mean "inappropriately unusual", while おかしい is when the strangeness reminds of dysfunction of some sort.
This formula is...
Even when you can use both, 変 here means giving impression of strangeness or counterintuitivity, but doesn't (necessarily) imply logically wrong (=dysfunctional), while おかしい does.
"Don't do anything I wouldn't do."
In this case, what they advice against to do probably has some bad effect, but not necessarily out of insanity (maybe they just intend to do), thus おかしい is not likely used.
変 and おかしい have the almost same meaning, but sometimes they're used in difference nuances.
first, the basic meanings of them are these:
変→strange, odd, weird
おかしい→strange, odd, weird or funny
As I wrote, 変 and おかしい can be interchangeable in many case. However, as I said in above, sometimes they have some different nuances.
(That thought(or idea) of you is odd.)
in the case with おかしい, the sentence would have implication that the thought is odd from my point view or in common values that I assume to be common.
while in the case with 変, it says the thought is far from common sense.
Of course, if you want to avoid using an aggressive way, you should add と思う to them, like "おかしいと思う or 変だと思う".
Although I wrote their difference, their difference of nuance is hard to understand, but what I want to say is that 変 sounds a little more critical or offensive sometimes than おかしい.
However, about their meaning, they're almost same.