Word for caring about the appearance of a matter but not its spirit

The word usually used, at least in Christian theology, is legalistic.

Dictionary.com gives a fitting definition of the noun (the noun and adjective have closely corresponding meanings):

legalism noun

  • strict adherence, or the principle of strict adherence, to law or prescription, especially to the letter rather than the spirit.

................

Lexico is more incisive in its definition, from a Christian perspective:

legalistic adjective

  • 1 Adhering excessively to law or formula.

    • ‘our conciliation process avoids an overly legalistic approach’
    • ‘narrow legalistic definitions’
  • 1.1 [Theology] Concerning adherence to moral law rather than to personal religious faith....