First, we need to create a new graph removing all the bridge(s)/cut-edge(s). Now, we need to construct a tree from the new graph. For each connected component in the graph , create a node for the tree . And for each node from the original graph, keep track of which node from the original graph, belongs to which node of the tree .
We can complete the above operations in time complexity.
For two nodes of each bridge of the original graph, find which node of the tree belongs to and connect those nodes. The new graph we've created in this way will be always a tree. Now, create a sparse table using this tree .
For each query, find the distance between and using their LCA. The distance is the answer.
We can create the sparse table within time complexity and answer queries in time complexity.