Phonosemantic compound. 虫 represents the meaning and 唯 represents the sound. Based on the original meaning "type of lizard". The current meaning is a phonetic loan.
雖 and 唯 don't sound similar in modern Mandarin due to historical phonetic changes. They were more similar in older Chinese.雖 /*s-qʷij/ 唯 /*ɢʷij (< *ɢʷuj?)/