The Shearim Metzuyanim Behalacha on the Kitzur Shulchan Aruch (חלק א - כג ס"ק א, מהדורה תשס"א) writes:
As is known, we are obligated to stand for the Sefer torah, and this
is learned from the obligation to stand for a torah scholar, for if we
stand for those who learn the the Torah, all the more we should stand
for the Torah itself. Rashi in Avoda Zara (17a) states that it was the
custom when taking leave from the Synagogue, the people would kiss the
most honored among them in a sign of respect, following this it would
be fitting to kiss the Sefer torah as well, in line with Kal Vechomer
the Gemara makes to obligate standing for the Torah from the
obligation to stand for the Talmid Chacham. This would seem to be the
source for the custom to kiss the Torah scroll as it passes.
This is the interpretation of the Rema (או"ח קמט), that we bring the
children towards the Torah to kiss it on post to encourage and educate
them in the observance of mitzvos, that this does not mean only
children, rather even adults should kiss it but that there is a value
in educating the children to this as well.
The Siddur Yaavetz and other siddurim quote the custom of the Ariza"l
to kiss the sefer torah, it is also said that one should kiss with his
lips specifically, and not the hands as is the custom of the general
public. However the Sha'ar Ephraim (שער י' ס"ד) says that if it is
difficult to kiss with the lips one can kiss with his hand.
The Pninei Halacha (מדיני קריאת התורה פרק כב' ס' ג) writes:
נהגו שכל מי שספר התורה עובר לידו מנשקו ומלווהו מעט. הרוב נוהגים לנשק
את התורה בפיהם ממש, ויש שנוגעים בו בידם ומנשקים את היד (ע' פס"ת קמט,
א-ב). וראוי שחולה או מצונן לא ינשק את התורה בפיו, כדי שלא להדביק את
שאר המתפללים במחלתו.
The custom is that anytime a Sefer Torah passes one should kiss it and accompany it a bit.
The majority have the custom to kiss the Torah directly with their lips, but some touch with their hand and kiss the hand.
It is preferable of someone is ill should not kiss the Torah with his mouth so as not to infect others with his illness.
The custom of some Spanish and Portuguese synagogues, specifically in New York and London (As I have personally witnessed them, and I cannot attest to other Shuls), practice the custom to bow slightly to the Torah as it passes.
This was also the custom of some synagogues in Uzbekistan-Buchara.