I think it would be pretty unlikely that you'd confuse the two, because context usually helps distinguish them. Also, straight up saying 彼氏が要る sounds a bit weird to me, because it sounds like you're saying "a boyfriend is required", rather than I need a boyfriend. Further, 居る (what you simply wrote as いる but I chose to write in kanji for the purpose of differentiating both verbs) is 一段 ('ru'-verb) whereas 要る is 五段 ('u'-verb), so they change when taken to the polite form, 居る becoming 居ます and 要る becoming 要ります (notice the addition of り in the second one).
In general, the structure you are looking for is either 必要 or ほしい. The first one literally means "there is a need for... X" or "X is required", whereas the second one is close in meaning to saying "I desire X". It is usually the second structure that would be used to say something similar to the English "I need a boyfriend" in my opinion, where you would say 彼氏がほしい, "I would like a boyfriend". If you are trying to say a boyfriend is necessary (usually for something), you could say 彼氏が必要。