I mean, there are people who can't sing melodies correctly but they are able to play the guitar perfectly. Will such person be able to play the trumpet? When you hit the note on the trumpet do you have to worry about the correctness of the note or trumpet does it for you? I play the guitar, I even sing sometimes but I'm worried, will my musical hearing be good enough for the trumpet? Hope I made myself clear.
Trumpet - sort of. Trombone - absolutely not.
The reason is that with a trumpet you have 8 possible fingerings, and for each there is a limited number of tones from which to choose by lip pressure. As a beginner you will only need the lower tones, which are spaced so far apart that it's extremely hard to hit the wrong one without noticing. Only getting a clean intonation might be tricky for you because it involves having precisely the right amount of lip pressure to get the intended result - so you have to hear whether the intonation is right. (I don't think this is a big issue with the guitar once it has been tuned.)
With the trombone, instead of fingering you'd have to find exactly the right spot on a continuous scale. That's harder than hitting the right tone when singing. Of course if you have a musical ear and there is merely something wrong with your vocal cords, then this is not an issue either. (In that case the comb, the kazoo and the didgeridoo are the only instruments I can think of right now that would be problematic.)
It helps a lot, and indeed, the trumpet is much more difficult than the guitar if you have no perfect hearing. The issue is that your breathing technique affects the note that you're playing, and if you breathe incorrectly, the outcome will also be incorrect. If you are not able to hear where you go wrong, it's difficult to play perfectly.
Regardless, I think you should give it a try. I know somebody who has played the trumpet for years. His "musical ear" is quite bad, and although he's not a professional (quite far from it), whatever he plays is always pleasing to the ear. Part of that is because he took lessons. Teachers can teach you what exactly to pay attention to, so that you can tell whether you're playing correctly without requiring a sense of absolute pitch. I can not give you any specific tips because I do not play the trumpet myself, but I know that these techniques & tricks exist.
Lastly, as @Édouard said: the ear can be trained. If you play music a lot, your musical hearing will improve significantly.
Singing specifically is not necessary. I can't sing at all, but I played trumpet for many years - only as an amateur, but I was certainly good enough at it to hit the right notes. :-)
However, you do need a decent ear for pitch, enough to hear when you're playing the wrong note. Any given finger position on the trumpet will let you play many different notes, a whole harmonic series in fact. The way you control which note of the series comes out is by adjusting your lip pressure and position and the intensity of your breath. With practice, you can get a feel for what you need to do with your mouth to play a given note; however, before you develop that intuition, you will need to hear what note you're playing and be able to compare it to the desired pitch so that you can adjust up or down as needed. And even after you know how to position your mouth for each note, you still play more accurately when you can hear and correct for when you're playing too high or low.
I have owned a Holton T602 trumpet. I bought it new 20 years ago or so. Very nice sounding trumpet although it needed more frequent cleaning than other brands I played. It originally came with a "Frank Holton 7C" mouthpiece but I have been using all sorts of trumpet mouthpieces on it with no problem. The only thing it wasn't very fond of is very big mouthpieces like Bach 1C and bigger, wich would make the tuning too low. After trying out many many mouthpieces I settled on a Bach 10.5C wich is considered quite small by modern standards (not by older standards), but perfect for me, even though I am a tall guy. No idea about you, mouthpieces are like shoes, they have to fit. For some reason, the general consensus is that bigger(lower number) is better, based on a 1920ties recommendation from Vincent Bach that everyone keeps repeating, but I don't agree with that. I'm sounding better than ever on this small piece and it's less straining also.