Another user provided an example and I have added others:
Key to exercise
Key for exerciseAnswer to a problem
Answer for a problemBullet to a gun
Bullet for a gunShe bought a taser to self-defense.
She bought a taser for self-defense.We give alms to the poor.
We give alms for the poor.She gave the order to the cook.
He put in the order for dinner.
Some of these seem pretty clear to me. I would select {to, to, for, for} for the first four, but the last two made me wonder if there is some rule at work, or if I'm basing it off what sounds better from repeated hearing. For instance, I might give "alms to the poor," but if I were poor then I'd bother passerby with "Alms for the poor?"
Is there some "pairing" going on (i.e. an answer is always to a question/problem/etc.)? Perhaps by plugging words into "this goes to that" or "this is for that", one could determine the proper usage. I'm looking for an explicit description or "rule" of what feels like an innate quality of the words. I believe Spanish has a similar dichotomy with para and por, but I'm not sure whether this translates (no pun intended) to English.