Kant says, in the First Analogy of Experience, that we perceive objects enduring in time, i.e. substances, with only their states changing. He furthermore states that there is a connection of this principle to the law of conservation of matter of physics of his time and that this principle is due to the necessity of representing the unity of time by the subject in the object, as far as its an object of experience, and thus formed according to space and time (per Transcendental Aesthetic). Kant says that we represent the unity of time in the object of experience by representing it as an enduring substance with changing states.
We, however, need, as you note, a criterion for the identity of these substances. Since all states of a substances, in principle, might change, it's not trivial to determine whether two subsequently perceived, materially (in the sense discussed by Kant's Postulates of Empirical Thought) different objects constitute the same substance (in which case we perceive change) or are different (in which we merely perceive two distinct object one after the other). Kant makes this distinction as the distinction between representation of sequence [in time] and sequence of representations [in time].
Kant investigates the conditions of empirically perceiving (as
Sebastian Rödl notes, in his Categories of the Temporal, page 185-186, many commentators think that Kant denies our ability to perceive change which is refuted by him in the plainest words) change, or, in other words, perceiving that some substance was some way and now isn't that way. For example, the Ship of Theseus being repaired constitutes a change. He posits that in any perception of change we find an application of a general rule according to the category of causality. We, however, have no certain knowledge about causal laws (thus the relational categories, like causality, are dynamical and their corresponding principles, i.e. the Analogies of Experience, are regulative). This is then also true of the determination of the identity of substances inbetween perceptions - we might be wrong about that, although ultimate, exhaustive natural science would provide sufficient knowledge for determining their identity in time.
There's also, as I said, a connection to Kant's discussion of Newtonian physics in Metaphysical Foundations of Natural Science, but it's somewhat unrelated to your question, so I can just reccommend you to read the work, if you're interested.