You can create a vanilla extract by soaking the beans in vodka for a few days, pour the resulting liquid into the secondary and rack on top of that.
Your beer should have finished fermenting if you are racking to a secondary. Chances are the alcohol now in the beer will protect it from any bugs on the beans. I think you'd be safe to just toss em into the secondary without too much worry.