The Kantian notion of respect for persons is related to the presentation of the formula of humanity although the notions are presented in distinct works. The Groundwork discussion of the formula of humanity brings out a number of distinct features concerning what our attention should be concerned with when we are dealing with humans (who stand in for rational beings generally and hence persons). The point of the formula of humanity is to identify persons as being distinct from anything that can simply be used as a means. It is not that persons are incapable of being morally related to as means. It is rather that any such moral relation to persons has to incorporate the sense that they are also ends in themselves.
One of the key elements of relating to persons as such ends in themselves is the sense in which it requires an alteration of what is involved in the notion of "end". It is natural for contemporary philosophers to use the term "end" as something to be realized or achieved. So we think of an "end" in this respect in the sense in which Kant formulates hypothetical imperatives. But such a sense of "end" is far from being the only one with which we standardly work. It is also the case that we have a sense of "end" that looks not towards an achievement that is aimed at but simply at respecting something that is given. This is not an arbitrary construct of Kantian theory but something that everyday moral concern already recognises.
To take a standard example from the notion that is said to belong to the ethics of care: what is involved in caring for another? To care for someone involves treating them in such a way that their welfare is of direct concern to us. This does not mean that there is an end that we wish to bring about here. There are cases that seem to involve such an end, as, for example, when the caring relation of nursing might be thought to aim at helping someone become well. However, nursing often is not engaged with that but rather with helping someone come to terms with the kind of illness they have. In this latter case the "end" is not some kind of state (since this requires dealing with the illness in a long term way, i.e. in living differently) as rather an alteration of focus.
In taking persons seriously we have to act in such a way that they are realities to us. It is easy not to view them as realities but as part of projects of our own. That second way of relating to them replicates the sense that they are "ends" only as means of ours. And this helps us to see that the Kantian sense of ends in themselves is part of ordinary moral concern since to only treat persons as ends of our own is to act towards them in such a way that there are no human relationships as such but only instrumentalities of engagement.
When Kant discusses the example of promising in the Groundwork the nature of acting towards persons as ends in themselves becomes clearer as here we see that the action of maintaining a promise is not primarily something to be undertaken due to hypothetical questions of the lack of confidence that might ensue if promises were routinely broken. It is rather that the engagement with another that is a promise is one in which reciprocity is affirmed as the basis of action. Such reciprocal concern as is involved in maintaining a promise to another is acting with the other in view (as if their consent to one's action or the possibility of such consent mattered to one).
When Kant discusses respect in the Critique of Practical Reason he does so with the aim of showing that respect for the other person is the most direct way of showing respect for the moral law. There are obscurities to this connection that I will leave to a future posting. For now what I want to emphasize about this connection is that the other person's conduct shows the law in action for me as well as the other person being the one for whom I act when I act morally. It is, as it were, the other within to whom I am indebted. The other within is the one that calls me to morality and the transcendence of mere self-valuation. It is difficult not to see the other as the moral law commands in a sense. This is the sense in which, if the other is real, then my conduct is necessarily such as is mirrored in their response and in their acts towards me. Respect is discussed by Kant as a tribute paid to merit and the merit of the other is that they show to me what it is to be moral but they not only do this in the case of examples as he stresses but also in being such as transcends instrumental relation. This is the sense in which the experience of the other is moral experience as such, something that perhaps suggests a closer connection between Kant and Levinas than some have tended to grant.