TL;DR
Do not relay on colliders for fast moving objects. You need to use “Physics.Raycast” to determine when a collision took place.
Long version
Now, how actually to do it.
Usually you have this problem with bullets or bullet like objects (like arrows oh whatever). In any other case you can just set “Collision Detection” to “Continuous” (in the Rigidbody of your object), and it will just work fine.
The issue is related to how collision detectors work. They do have their lifecycle. They can’t check for collisions at any given moment. Therefore, if you have a gameObject that moves fast enough, it can pass the collider check “between heartbeats” and wouldn’t trigger the collision function.
The solution is to write a custom collision check. Now your situation may be different, but the general approach is the following:
With this approach it doesn’t matter what is the speed of your “bullet”.