I'm studying Hilbert's axiomatization of Euclidean geometry, and I'm trying to combine my current understanding into my knowledge on mathematical logic (not very much).
At the beginning of this axiomatic system, it states the undefined terms are 'point', 'line', 'plane', 'lie', 'between', and 'congruence'. Therefore it seems that all later definitions should be based on these primitive notions. However, in the definition of 'segment', it states that a segment $AB$ is a set of two points on the same line. (or another variation where the segment contains also all points between two endpoints.)
My question is: how does 'set' come into play here? There is no notion of 'set' defined in this system, how is it valid to use the notion of set (or notions about sets like equivalent class) here? More generally, how does set relate to a specific mathematical theory?
Being a beginner on foundation related topics, I would appreciate if you can explain different concepts in a slow pace. In my understanding, Hilbert's system is a purely syntactic system with some undefined terms. It might be helpful if you can show me how the definitions (like segment) can be produced by FOL language.