What you are referring to is typically called a geofence.
There are a few different way you can do this, the simplest probably being a purely circular fence, which you can enforce by just measuring your distance to the center of the circle. A distance() function will accomplish this for you, which sounds like what you are doing already.
A slightly complicated rectangular fence can be enforced by checking your GPS latitude and longitude each lie within a certain prescribed range. A long-ish if() statement comparing your location to each min & max latitude/longitude will do this for you.
An even more complicated (convex) polygon fence can be enforced with a rather more sophisticated algorithm and form; see ODK geofence (v1), and Geofencing in ODK forms
But, wait for it...
...there is actually a new dedicated ODK geofence feature coming out Real Soon Now™ (!) If you poke around javarosa - the form engine underneath ODK Collect - you might spot it:
(or if you like deciphering code, start digging around https://github.com/getodk/javarosa/blob/master/src/main/java/org/javarosa/xpath/expr/XPathFuncExpr.java)
This should show up in an upcoming release of ODK Collect/KoboCollect.
[Disclaimer: written by yours truly ]