No it is not okay. That's just a rebound. Sometimes, people get in such relationships only because they need the emotional support and a cushion to cry on. It's understandable as we're humans and we all need love. But in all honesty, it's not fair to the other person. An individual must only get involved with another when they genuinely feel for someone and have love to offer them...Not all relationships need to culminate into marriage, but we need to respect someone's feelings, time and love.
As for the matter being just to forget an ex, then there are tools to help you do that - on your own! No one must just use someone only for their own selfish motives. If you are married and are dealing with a separation, then giving yourself time to heal would be a wise thing to do.