The Greek text used by the NASB reads:
πάντα οὖν ὅσα ἐὰν εἴπωσιν ὑμῖν, τηρεῖτε καὶ ποιεῖτε
All whatsoever they tell you, observe and do
The majority of manuscripts contain a slight variation on this:
πάντα οὖν ὅσα ἐὰν εἴπωσιν ὑμῖν τηρεῖν, τηρεῖτε καὶ ποιεῖτε
All whatsoever they tell you to observe, observe and do
The word translated as "observe" is τηρέω (tēreō). It the Septuagint it was used more frequently in the sense of "keep" or "guard", as in a person or thing1. It is used here in the sense of "keeping the law", as we also do in English, as in:
Keep the law and the commandments (τήρησον τὸν νόμον καὶ τὰ προστάγματα)2
Keep the commandments (τήρησον τὰς ἐντολάς)3
In Matthew 23:3, Jesus is referring specifically to following what the scribes and Pharisees teach regarding observing the Law. Hence the word tēreō and the reference to the chair of Moses.
Matthew 16:12 refers not to the doctrine (Law) of Moses, but rather to the doctrine of the Pharisees (Gr. διδαχή - didachē, translated as "teaching" in the NASB). He is possibly referring to the spurious traditions he had recently condemned (Matthew 15:1-20). Luke describes the leaven of the Pharisees as hypocrisy.4 He also calls to mind the recent miracle of the seven loaves5 when upbraiding the Apostles, so He may also be warning them to expect the Pharisees to spread doubts about the miracles they witnessed. It may be any or all of these things, but in any case I don't think there is a contradiction between the two commands: observe the Law as the Pharisees teach, but beware of present and/or future falsehoods and distortions in their other teachings.
1. e.g. Genesis 3:15, Proverbs 2:11, 1 Maccabees 4:61
2. Tobit 14:9 (RSV translation)
3. Matthew 19:17 (NASB translation)
4. Luke 12:1; cf. Matthew 23:28ff
5. Matthew 15:32-39; Mark 7:37-8:10