For instance, in the phrase 「我善养吾浩然之气」
I notice both 我 and 吾 are used. Is there a reason for this?
The first thing to point out is that「吾」(Baxter-Sagart: /*ŋˤa/) and「我」(Baxter-Sagart: /*ŋˤajʔ/) are cognate. They mean exactly the same thing, and were interchangeable to a very large degree; as the comment pointed out, the use of one over the other is due to either personal preference, emulation of ancient texts, or to avoid repetition.
Specifically in the pre-Qin era, there was some difference in their usage that eventually disappeared by Middle Chinese.「吾」could not be used in the pre-Qin era as an object after a verb. Quote from Zhuangzi:
子綦 said: "偃, it is very good that you asked this question! I had just lost myself now, but how should you know the answer?"
「吾喪我」could not be written as「我喪吾」in this era.
for classical chinese, most "吾" means "i", occasionally, it means "my", or "mine".
"我" means "i", "me" or "my"; depends on the verse.
here're some usages from analects (論語):
the first 吾 means "i", the second 吾 means "my"
daily (日), i (吾) reflect upon (省) my (吾)-self (身) three times (三)
this 吾 means "i"
ok (諾), i (吾) will (將) ask (問) about it (之)
吾 means "my", or "mine", depends on the english style.
the Master (子) said (曰): "[he's] not (非) my (吾) disciple (徒)
the Master (子) said (曰): "[he's] not (非) [a] disciple (徒) of mine (吾)
"我" means "i"
the Master (子) said (曰), "i (我) [am] not (非) one (者) who was born (生) in the possession of knowledge (而知之)
"我" means "me"
the Master (子) said (曰): "Of those (者) who were with (從) me (我) in (於) Chen (陳) and Cai (蔡)
"我" means "my"
the Master (子) said (曰): "When I walk along with two others (三人行), they may serve me as my (我) teachers (師)
so, back to your question "what is the difference between 吾 and 我 in 文言文？"
i would say, they're interchangeable.
about "我善養吾浩然之氣"; well, no idea about using both "我" & "吾" in the same verse.
have fun :)