There’s a user script for keeping track of these
As you noticed, it’s often not universal. This is because not every instance of a particular element is in a phono-semantic compound, or sometimes changes to kanji over time obscure the original sound relationship.