Interval function of a graph is a well-known notion in metric graph theory and the axiomatic characterization using a set of first order axioms of different graph classes is an interesting problem in this area. Partial cubes and partial Hamming graphs form one of the central graph class that can be embedded into hypercubes and Hamming graphs respectively. In this paper we present an axiomatic characterization of the interval function of partial cubes and partial Hamming graphs, using different first order axioms. Further, we give an axiomatic characterization of the interval function of these graphs using axioms on an arbitrary function R on V.