I read that, after Cordelia left, the writers felt that there needed to be another character who would tell Buffy that she "was stupid and going to die." They wanted Spike for that, but found Anya worked better. So her lines probably did sound like Cordelia, contributing much-needed sarcasm!
I guess they are both sort of similar, with sarcastic and doom and gloom bringing remarks, but also relatively well meaning. When Cordy left they probably wanted someone to sort of replace her and bring that element of satirical comedy
They are very similar characters and serve much the same function within the show, but I think the difference is that Cordelia was confident and her sarcasm came from not allowing others disrespect or take advantage of her. Whereas Anya's sarcasm comes from a place of not knowing the social rules, of being a person out of time who simply didn't understand the niceties of personal communication.