First, decide whether you're looking for publishers or agents. I don't recommend to subbing to both at the same time. If you get an agent, the agent won't be able to sub to publishers you've already subbed to (at least not with the same manuscript). I think it makes sense to try for agents first. If you don't get one, or if you get one but then part ways if your book doesn't sell, you can contact publishers on your own. Many big publishers only accept agented subs, but there are some respectable publishers that don't require an agent.
For agents, look at what they represent and what books they've sold. Newer agents should generally have support from an established agency. Google the agent and check the Bewares section here to look for any red flags. Also think about what type of agent you want. For example, do you want an editorial agent? Do you want to write in multiple genres?
For publishers, look at what they've published. Do the books have good covers? Are they well edited and formatted? Do they have good reviews, including professional reviews from places like Kirkus and SLJ? Again, Google the publisher and check the Bewares section here to look for red flags. Don't just go off the publisher's website, which could be misleading.
Don't give an agent or publisher money. An agent works on commissions, and a traditional publisher pays the author, not the other way around. Also avoid publishing contracts that require you to buy a certain number of books. This is just another way of charging authors to publish. Traditional publishers usually provide a small number of free copies (up to 20, in my experience, but sometimes fewer) and the option to buy more, usually at a discount.
If you get offered a deal and you don't have an agent, do some research on standard contracts, as well as clauses to avoid or negotiate. It's always good to have the contract reviewed by a publishing expert.