It depends on the specifics of your case, but in general, this is a viable option when your mark is similar (phonetically or visually) to the other mark, but you are using it for entirely different goods and/or services.
Negotiation with the owner of an earlier conflicting mark can help clarify the distinctiveness and scope of each mark and preempt any concerns, which can help you avoid costly and time-consuming legal disputes, such as opposition or cancellation proceedings. Contacting the owner of an earlier conflicting mark can be a proactive way to address potential conflicts before they escalate.
If you are not sure how to approach the other party, you can seek the help of a legal professional who can negotiate on your behalf and also prepare a proper co-existence agreement.