Thank you for the great advice, Thomas and David. I was able to construct my desired function as follows:
\version "2.18.0"
% Voice leading lines are drawn as dashed glissandi
voiceLine =
#(define-music-function
(parser location staffA staffB noteA noteB)
(string? string? ly:music? ly:music?)
#{
\override Glissando #'style = #'dashed-line
\override NoteColumn #'force-hshift = #0
\override NoteHead #'transparent = ##t
\change Staff = #staffA <>\glissando #noteA
\change Staff = #staffB #noteB
#})
This can then be called in the music as, for example:
\voiceLine "down" "up" a2 a2