I was taught growing up that you could substitute a ii chord for a IV chord because it shared common tones. That is true to an extent, but the ii chord most naturally substitutes for the V chord. Watch this video to understand why.
If you don’t see the video below, click here: https://www.youtube.com/watch?v=sFKUl3HbRz8