The phone was wiped but they left their AppleID logged in. I deleted their AppleID and their iCloud account from the phone and replaced it with my own.
Will my stuff still go to their iCloud?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
It's not clear what you mean by you've deleted their Apple ID and iCloud account from the phone, but if you've fully signed out of all services (i.e. Apple ID, iCloud, iTunes and App Store) then you're on the right track.
However, your friend needed to follow some steps before selling you their phone. According to Apple, this is what someone should do before they sell or give away their iPhone, iPad, or iPod touch.
I would start again by getting together with your friend and double-checking that everything is done the way it should be.