Arduino uno, interrupt like code

Thank you, I am using divider so frequency range is no a problem

You appear to be using a library called FreqCounter which is here Library: FreqCounter

OK, you are not trying to measure 20MHz directly, and you are using a library. You should have told us this in your first post.

The main problem is that I am also displaying it on display and when input occurs during that time, it is not able to catch it. I need something what enables me to priorly read input from pin 5 immediately when it occurs so I will catch all pulses.

Your issue appears to be that uglib8 and the tft display are blocking the frequency reading. I doubt that you will be able to get a randomly frequency reading to interrupt the display draw, but I am not knowledgeable about uglib8.

You should probably not be updating the display every time through loop, but rather coordinating with updated frequency information.

Please tell us more about the frequency signal source? Is it continuous? Is it intermittant? What triggers the signal? Is it random?