Then you close the gap to a distance where your weapon is more effective.
I remember the first time I played battlefield and I couldn't hit a thing at more than 100m, I just played my class and gradually got used to when to engage and when not, if I thought I could kill someone or not, I learned that in situations I needed to keep my head down and find a way to get closer.
That's where teamplay comes into battlefield too, support for example could help by giving you that window to close the gap.
Battlefield isn't just about running around trying to zap everyone, you can get just as much satisfaction playing your role well.