In Taiwanese place names, how are 宮 vs. 寺 used?
佛寺 = Buddhist temple
道觀 = Taoist temple
宮 = palace
神社/ 神宮 = shrine
廟 = temple (polytheism)

Searching 'Taiwan Buddhist temples' and I found a list.
Many entries with the name 宮  in it are labeled as 'Buddhist temples' but they are in fact,  temples for individual gods in Chinese polytheism
For example:
大龍峒保安宮 (Dalongdong Baoan Temple)
You can see the idol is a Chinese god, not Buddha.

松山慈祐宮 (Ciyou Temple)
The photo from its web site clearly showed 燒衣 and 求簽 equipment. Buddhist temples do not have that.


台北天后宮  (Taipei Tianhou Temple) is a place to worship '天后', it is in the temple's name
大龍峒保安宮, 松山慈祐宮 and 台北天后宮 are not Buddhist temples but Chinese polytheism temples
In Japan, shrine are called 神社, 神宮,  Since Taiwan has deep tie to Japanese culture, using 宮 in temples name is understandable