In short, they are units of meaning, and consist of stem and affix morphemes. Affixes are either derivational or inflectional. The word ‘unlocked’ contains three morphemes ‘un-lock-ed’. The verb ‘lock’ is the stem morpheme: ‘un’ is a derivational morpheme that changes its meaning (‘unlock’ is the opposite of ‘lock’), and ‘ed’ is the inflection telling us that the verb is either in the past tense or a past participle. Morphemes have a great impact on spelling: the only reason that the endings of ‘fox’ and ‘list’ are spelled differently from ‘socks’ and ‘kissed’ is that the first two words are one morpheme words while the last two are two morpheme words whose inflectional affixes have their own characteristic spelling.
See Affixes, Morphological marking, Morphology, Orthography, Phoneme, Syntax