I was looking in a dictionary, and both were listed as being defined as "to lose one's way, to hesitate, or to waver," but I don't understand why there are two different kanji for the word.
Dave already answered that there is no difference in 迷う and 紕う in modern Japanese. Dictionaries agree on this. However, the original meanings of these two kanji are completely different, and the reason why まよう has these two kanji notations is related to the history of the Japanese word まよう itself, which is explained in Daijisen.
Originally, the Japanese word まよう meant for a fabric to become spoiled and for threads in a fabric to get tangled. This is the meaning of the kanji 紕. Note that the radical 糸 (いと; thread) is in this kanji. I do not know if the word まよう is used in this meaning in the modern Japanese.
There was an unrelated word まどう which meant to be puzzled or to get lost. Later the words まよう and まどう got confused, and まよう started to be used also for the meaning of まどう. This is why まよう means to get lost in the modern Japanese! The kanji 迷 means to get lost, and it matches the new meaning of まよう (although まどう is written as 惑う using a different kanji from 迷). The radical 辶 of 迷 means a road.
All of this suggests that 迷う and 紕う are actually different words with different meanings, tempting me to claim that it is incorrect to use 紕う for the meaning “to get lost.” However, as you and Dave said, dictionaries list both kanji as acceptable and do not seem to make distinction in meanings between the two kanji. Although I do not know the exact reason for this, my guess is that the two notations 迷う and 紕う were used interchangeably in the actual Japanese text often enough to justify listing both kanji in dictionaries.
Edit: In an earlier revision, the last paragraph of this answer was unclear. I reconsidered it, and hopefully this reflects my thought much better.
OK. Not the greatest answer (based on partial ignorance rather than knowledge), but on the chance nobody can come up with better:
紕う and 迷う are ostensibly two spellings of the same word (まよう). This happens a lot in Japanese, as you probably know and is a characteristic feature of the weird marriage of native (oral) Japanese with native (written) Chinese hanzi. Many common Japanese words historically have two or three kanji spellings (see, for example: all the different spellings of あける).
In this particular case my feeling (and it seems shared by both fluent foreigners and native speakers) is that 紕う is an extremely rare spelling of 'まよう'. Unfortunately, I cannot give you any information about a possible nuance between the two, since even the Japanese internet doesn't seem to have any, but regarding how rare 紕う is:
- I have never seen it used, where "迷う" would be typically.
- It is conspicuously absent from the Tanaka corpus of Japanese sentences (the kanji only appears in entirely different compounds/readings).
- My IME (Mac OS X) has never heard of it: doesn't offer it as a choice, however hidden for 'まよう'.
Based on all this, I think we can safely say 紕う is a rare/obscure/obsolete form and 迷う should be used whenever you want to say "lost/confused".