If you file a trademark application and find out there is a holder of an identical or confusingly similar name working in the same industry (and attracting the same customers with related goods and services), your application might get threatened.
If your application passes the examination process, it is published for opposition. The length of the opposition period depends on a concrete jurisdiction. For example, in the US, the opposition period is open for 30 days. In the EU, it is three months, and in the UK, two months. Additionally, these periods are usually extendable.
During the opposition period, any holder of a similar or identical mark has legal grounds to oppose your trademark application based on the likelihood of confusion between the marks. If you receive opposition, you are always invited to resolve the issue amicably with the third party (opponent). If this is not the case, the final ruling will be established by the IP office based on the evidence provided by the 3rd party and your response to the evidence. It is always a good idea to hire a legal representative who can respond to the opposition on your behalf.