I know that both are considered subject particles but when do you use one over the other?
은/는 mark the "topic" of a sentence, while 이/가 mark a "subject". This alone doesn't really help all that much to know when exactly to use which. For me, it really clicked when I learned longer English translations of the two:
나는 집에 왔어
As for me, I came home.
Talking about me, I came home.
내가 말한 거야.
It is me who said that.
너는 뭐 해?
Regarding you, what are you doing?
내가 먹은 사과는 맛있었어.
As for the apple that the one who is me ate, it was tasty.
Whenever I am in doubt, I just replace both with these longer equivalents, and it usually works.
The 는 and 은 markers are "topic markers" and are used when introducing a new subject. The 가 and 이 markers are "subject markers" and are used when discussing a known topic. The difference can be subtle.
For example, "책은 재미있다" and "책이 재미있다" both translate to "this book is interesting," but the first one implies that a particular book is being discussed (perhaps different from another book that was just previously discussed), whereas the second one is where perhaps an additional statement is being made about the book that is already being discussed.