How to get the updated vertex coordinates of a cube when rotating?
Changing verts to match those of other objects in handler.
To linearly rotate an object in a scene, suggest that a driver is possibly the simplest. How do I make animations a steady speed?
Given your prior question How to update the connection shortest line between the vertice of a cube and an Ico sphere?  and my answer to it
I have added a simple 2 vert object named &quot;Edge&quot; for example below it is parented to the cube (not vertex parented)
The frame change handler sets the location of the edge object to a random cube vert, and sets the other end to a randomly chosen vert on the depsgraph evaluated ico sphere.  Since the edge mesh has been object parented to the cube mesh, will work in the cube object's object coordinate space. .
When using get to get an object it will return None if no object with that name exists in the objects of the scene passed to the handler.
An evaluated  depsgraph is also available as the second argument of a post frame change handler.

Scrubbing the timeline to test handler, notice both ends are always at vert locations.  The cube is animated via keyframe (as per prior)
import bpy
from random import choice

def update_scene(scene, depsgraph):
    edge = scene.objects.get(&quot;Edge.004&quot;)
    #edge = edge.evaluated_get(depsgraph)
    cube = scene.objects.get(&quot;Cube&quot;)
    ico = scene.objects.get(&quot;Icosphere&quot;)
    imw = ico.matrix_world
    cmwi = cube.matrix_world.inverted()
    # if wish to use evaluted 
    ico = ico.evaluated_get(depsgraph)
    v0 = choice([v.co for v in cube.data.vertices])
    v1 = choice([v.co for v in ico.data.vertices])
    edge.location = v0
    #edge.data.vertices[1].co = v0
    edge.data.vertices[1].co = cmwi @ (imw @ v1) -  v0

Replace the random choice with the kdtree code from your other question.  Could make the kdtree outside the handler method.  Recommend tho don't reference objects from outside and use within the handler, always get from the scene objects via some test.
Rather than altering vertex coordinates, another method would be to make a unit length edge, arbitrarily in Z direction, and position and rotate based on end points... more akin to a stretch_to bone constraint.