Phonology

A sound has one pronunciation at the end of a word and another before a vowel. The two pronunciations never distinguish words, and the difference follows the context consistently. What is the strongest general analysis?