I think generally you are right about question 2 but not always. Sometimes depending on the page you are rendering it does make more sense to do some work there. I try to limit the amount of data I am looping and how many times I loop. if you pull a collection then map it then filter it then ... you get the idea. each time is a pass on the data. This is just my OCD. I think there is probably not much impact for most things. its just my personal best practice to think about how many rounds I make in all my queries and then the collection.
I don't quite follow your data but its seems like you could just do
FlashCard::whereRelation('topics', 'id', $theTopicId) // the rest of the query or ->get() etc.
// Or
FlashCard::whereHas('topics', fn ($q) => $q->whereIn('id', $arrayOfTopicIds) )
Im sure there are plenty of search results for handling the presentation of the questions so I'll leave that bit out.