I'd say most good restaurants would prefer you complain while still in the restaurant. That will give them a chance to listen to your problem and try to find a mutually beneficial solution.
If you have a problem with the food it's acceptable to speak to your server. If they cannot solve your problem, ask to speak to a manager.
If you have a problem with the service you can ask the server to speak to a manager. If you feel uncomfortable with that, walk up to the host stand and ask for a manager.
Good managers are trained to listen to you, apologize and address your concern. Good managers don't want you to leave unhappy so they will do their best to correct the solution.