"As a team, we need to think about finishing on a good note. But it makes me feel very sad and emotional that I'm going to leave," Tahir said as quoted by AFP.
"It was always my dream to play international cricket and I'm really grateful to everyone who helped me along on the way. They accepted me for who I was, the guy who came from overseas.
"It's a big moment of my life -- I always wanted to play cricket and play as long as I could and now is the right time to go.
"It will be quite a hurtful and sad moment for me but I've prepared myself for that, so hopefully it will go well for me and the team."
Tahir added: "I'm not worried about (the) future of the team -- there are a lot of youngsters.
"I strongly believe there is lots of talent but they just need experience and then they'll get to the stage where everyone wants to see South African cricket.
"People expect higher and a lot from us -- this World Cup was totally different but I'm pretty sure things will be fine for South Africa."
Tahir concluded his ODI career with 173 wickets in 107 matches. On the other hand, Duminy scored 5117 runs in 199 ODI matches. The all-rounder also claimed 69 ODI wickets with a career-best spell of 4/16.
The final four Australia, India, England and New Zealand now know who will play who in the semi-finals.
India's seven wicket haul over Sri Lanka at Headingley ensured that they ended on top, leapfrogging Australia following their 10-run defeat by South Africa.